diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2015-05-05 13:49:49 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2015-05-08 05:53:55 -0400 |
| commit | 0782e63bc6fe7e2d3408d250df11d388b7799c6b (patch) | |
| tree | c8b370c5093a2c89bd9ed384971e189e09ec49b7 /include/linux/sched | |
| parent | 3e0283a53f7d2f2dae7bc4aa7f3104cb5988018f (diff) | |
sched: Handle priority boosted tasks proper in setscheduler()
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>
Diffstat (limited to 'include/linux/sched')
| -rw-r--r-- | include/linux/sched/rt.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index 6341f5be6e24..a30b172df6e1 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h | |||
| @@ -18,7 +18,7 @@ static inline int rt_task(struct task_struct *p) | |||
| 18 | #ifdef CONFIG_RT_MUTEXES | 18 | #ifdef CONFIG_RT_MUTEXES |
| 19 | extern int rt_mutex_getprio(struct task_struct *p); | 19 | extern int rt_mutex_getprio(struct task_struct *p); |
| 20 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | 20 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
| 21 | extern int rt_mutex_check_prio(struct task_struct *task, int newprio); | 21 | extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio); |
| 22 | extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); | 22 | extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); |
| 23 | extern void rt_mutex_adjust_pi(struct task_struct *p); | 23 | extern void rt_mutex_adjust_pi(struct task_struct *p); |
| 24 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | 24 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) |
| @@ -31,9 +31,10 @@ static inline int rt_mutex_getprio(struct task_struct *p) | |||
| 31 | return p->normal_prio; | 31 | return p->normal_prio; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | static inline int rt_mutex_check_prio(struct task_struct *task, int newprio) | 34 | static inline int rt_mutex_get_effective_prio(struct task_struct *task, |
| 35 | int newprio) | ||
| 35 | { | 36 | { |
| 36 | return 0; | 37 | return newprio; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) | 40 | static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) |
