]> git.itanic.dy.fi Git - linux-stable/commit
sched: Handle priority boosted tasks proper in setscheduler()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 5 May 2015 17:49:49 +0000 (19:49 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Wed, 10 Jun 2015 17:42:31 +0000 (13:42 -0400)
commita0ed73fbe2457f1f47b638ee4ce8d4aae05d529a
tree194c7b85c7cddf8e9aab4c0b996936dc0b92892f
parent71b400b61c03f9982187a92d14ad643d9aa76bff
sched: Handle priority boosted tasks proper in setscheduler()

[ Upstream commit 0782e63bc6fe7e2d3408d250df11d388b7799c6b ]

Ronny reported that the following scenario is not handled correctly:

T1 (prio = 10)
   lock(rtmutex);

T2 (prio = 20)
   lock(rtmutex)
      boost T1

T1 (prio = 20)
   sys_set_scheduler(prio = 30)
   T1 prio = 30
   ....
   sys_set_scheduler(prio = 10)
   T1 prio = 30

The last step is wrong as T1 should now be back at prio 20.

Commit c365c292d059 ("sched: Consider pi boosting in setscheduler()")
only handles the case where a boosted tasks tries to lower its
priority.

Fix it by taking the new effective priority into account for the
decision whether a change of the priority is required.

Reported-by: Ronny Meeus <ronny.meeus@gmail.com>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: <stable@vger.kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Fixes: c365c292d059 ("sched: Consider pi boosting in setscheduler()")
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1505051806060.4225@nanos
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
include/linux/sched/rt.h
kernel/locking/rtmutex.c
kernel/sched/core.c