[Devel] [PATCH 1/2] sched: introduce cond_resched_may_throttle

Vladimir Davydov vdavydov at virtuozzo.com
Tue Jan 12 01:33:58 PST 2016


On Mon, Jan 11, 2016 at 08:15:35PM +0300, Kirill Tkhai wrote:
> From: Kirill Tkhai <ktkhai at odin.com>
> 
> Port diff-sched-introduce-cond_resched_may_throttle by Vladimir Davydov:
> 
> Since cond_resched() is sometimes called under a semaphore, it was
> forbidden to throttle tasks there in order to eliminate the possibility
> of the priority inversion problem. However, it turned out that some
> tasks must be throttled on cond_resched(), otherwise they won't have a
> chance to be throttled at all breaking the concept of CPU limits. The
> most notable (and currently the only identified) example is vm
> hypervisors such as KVM or Balalaika.
> 
> To fix this problem, the patch introduces the new function
> cond_resched_may_throttle(), which works just like usual cond_resched()
> except it allows the scheduler to throttle the caller's task group. This
> function must be used by those pieces of software that can only be
> throttled on cond_resched() under certain conditions. This function is
> to and will be used by Balalaika - I'm going to send the corresponding
> patch. Perhaps, it's also worth while using it in KVM, however there is
> no rush in it because I doubt anyone will use KVM, vzkernel, and our
> hacked CPU limits altogether so it can wait.
> 
> https://jira.sw.ru/browse/PSBM-18888
> 
> Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>


More information about the Devel mailing list