mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH linux-next] sched: Fix broken setscheduler()
@ 2014-03-06  4:29 Steven Rostedt
  2014-03-06 11:58 ` Peter Zijlstra
  0 siblings, 1 reply; 13+ messages in thread
From: Steven Rostedt @ 2014-03-06  4:29 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Sebastian Andrzej Siewior, Peter Zijlstra, Ingo Molnar

I decided to run my tests on linux-next, and my wakeup_rt tracer was
broken. After running a bisect, I found that the problem commit was:

   linux-next commit c365c292d059
   "sched: Consider pi boosting in setscheduler()"

And the reason the wake_rt tracer test was failing, was because it had
no RT task to trace. I first noticed this when running with
sched_switch event and saw that my RT task still had normal SCHED_OTHER
priority. Looking at the problem commit, I found:

 -       p->normal_prio = normal_prio(p);
 -       p->prio = rt_mutex_getprio(p);

With no

 +       p->normal_prio = normal_prio(p);
 +       p->prio = rt_mutex_getprio(p);

Reading what the commit is suppose to do, I realize that the p->prio
can't be set if the task is boosted with a higher prio, but the
p->normal_prio still needs to be set regardless, otherwise, when the
task is deboosted, it wont get the new priority.

The p->prio has to be set before "check_class_changed()" is called,
otherwise the class wont be changed.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4600bca..b1cc871 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3198,6 +3198,7 @@ static void __setscheduler_params(struct task_struct *p,
 	 * getparam()/getattr() don't report silly values for !rt tasks.
 	 */
 	p->rt_priority = attr->sched_priority;
+	p->normal_prio = normal_prio(p);
 	set_load_weight(p);
 }
 
@@ -3207,6 +3208,8 @@ static void __setscheduler(struct rq *rq, struct task_struct *p,
 {
 	__setscheduler_params(p, attr);
 
+	p->prio = rt_mutex_getprio(p);
+
 	if (dl_prio(p->prio))
 		p->sched_class = &dl_sched_class;
 	else if (rt_prio(p->prio))


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-03-12 10:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06  4:29 [PATCH linux-next] sched: Fix broken setscheduler() Steven Rostedt
2014-03-06 11:58 ` Peter Zijlstra
2014-03-06 12:20   ` Juri Lelli
2014-03-06 17:04     ` [PATCH v2] " Steven Rostedt
2014-03-06 20:43       ` Thomas Gleixner
2014-03-10 17:29         ` Steven Rostedt
2014-03-10 21:18           ` Thomas Gleixner
2014-03-10 21:37             ` Steven Rostedt
2014-03-11  9:35               ` Juri Lelli
2014-03-11 10:48                 ` Thomas Gleixner
2014-03-11 23:24                   ` [PATCH v3] " Steven Rostedt
2014-03-12 10:41                     ` Thomas Gleixner
2014-03-12 10:10       ` [tip:sched/core] " tip-bot for Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome