* [PATCH -v2] sched: Make sure task has correct sched_class after policy change [not found] ` <1257179120.10173.50.camel@marge.simson.net> @ 2009-11-10 19:12 ` Peter Zijlstra 2009-11-10 20:54 ` [tip:sched/core] " tip-bot for Peter Zijlstra 0 siblings, 1 reply; 2+ messages in thread From: Peter Zijlstra @ 2009-11-10 19:12 UTC (permalink / raw) To: Mike Galbraith; +Cc: Ingo Molnar, Peter Williams, lkml > On Mon, 2009-11-02 at 17:20 +0100, Ingo Molnar wrote: > > i zapped the buggy patch from sched/urgent already - mind sending a > > full, fixed patch? (with lkml and everyone involved cc-ed) Updated patch below... git branch -a --contains 67d08dfed042855431dc99c9e0e6f6f7e85737ef doesn't actually tell me anything other than tip/master, which is strange... I'd expect one of the tip/sched branches to have it too. Will you rebase whatever tree its in, getting rid of the initial commit and revert? --- From: Peter Zijlstra <a.p.zijlstra@chello.nl> Subject: sched: Make sure task has correct sched_class after policy change >From the code in rt_mutex_setprio(), it is evident that the intention is that task's with a RT 'prio' value as a consequence of receiving a PI boost also have their 'sched_class' field set to '&rt_sched_class'. However, Peter noticed that the code in __setscheduler() could result in this intention being frustrated. Fix it. Reported-by: Peter Williams <pwil3058@bigpond.net.au> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> --- kernel/sched.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) Index: linux-2.6/kernel/sched.c =================================================================== --- linux-2.6.orig/kernel/sched.c +++ linux-2.6/kernel/sched.c @@ -6188,22 +6188,14 @@ __setscheduler(struct rq *rq, struct tas BUG_ON(p->se.on_rq); p->policy = policy; - switch (p->policy) { - case SCHED_NORMAL: - case SCHED_BATCH: - case SCHED_IDLE: - p->sched_class = &fair_sched_class; - break; - case SCHED_FIFO: - case SCHED_RR: - p->sched_class = &rt_sched_class; - break; - } - p->rt_priority = prio; p->normal_prio = normal_prio(p); /* we are holding p->pi_lock already */ p->prio = rt_mutex_getprio(p); + if (rt_prio(p->prio)) + p->sched_class = &rt_sched_class; + else + p->sched_class = &fair_sched_class; set_load_weight(p); } ^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:sched/core] sched: Make sure task has correct sched_class after policy change 2009-11-10 19:12 ` [PATCH -v2] sched: Make sure task has correct sched_class after policy change Peter Zijlstra @ 2009-11-10 20:54 ` tip-bot for Peter Zijlstra 0 siblings, 0 replies; 2+ messages in thread From: tip-bot for Peter Zijlstra @ 2009-11-10 20:54 UTC (permalink / raw) To: linux-tip-commits Cc: linux-kernel, hpa, mingo, a.p.zijlstra, efault, peterz, tglx, pwil3058, mingo Commit-ID: ffd44db5f02af32bcc25a8eb5981bf02a141cdab Gitweb: http://git.kernel.org/tip/ffd44db5f02af32bcc25a8eb5981bf02a141cdab Author: Peter Zijlstra <peterz@infradead.org> AuthorDate: Tue, 10 Nov 2009 20:12:01 +0100 Committer: Ingo Molnar <mingo@elte.hu> CommitDate: Tue, 10 Nov 2009 20:22:31 +0100 sched: Make sure task has correct sched_class after policy change >From the code in rt_mutex_setprio(), it is evident that the intention is that task's with a RT 'prio' value as a consequence of receiving a PI boost also have their 'sched_class' field set to '&rt_sched_class'. However, Peter noticed that the code in __setscheduler() could result in this intention being frustrated. Fix it. Reported-by: Peter Williams <pwil3058@bigpond.net.au> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> LKML-Reference: <1257880321.4108.457.camel@laptop> Signed-off-by: Ingo Molnar <mingo@elte.hu> --- kernel/sched.c | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index ad37776..43e61fa 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -6159,22 +6159,14 @@ __setscheduler(struct rq *rq, struct task_struct *p, int policy, int prio) BUG_ON(p->se.on_rq); p->policy = policy; - switch (p->policy) { - case SCHED_NORMAL: - case SCHED_BATCH: - case SCHED_IDLE: - p->sched_class = &fair_sched_class; - break; - case SCHED_FIFO: - case SCHED_RR: - p->sched_class = &rt_sched_class; - break; - } - p->rt_priority = prio; p->normal_prio = normal_prio(p); /* we are holding p->pi_lock already */ p->prio = rt_mutex_getprio(p); + if (rt_prio(p->prio)) + p->sched_class = &rt_sched_class; + else + p->sched_class = &fair_sched_class; set_load_weight(p); } ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-10 20:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1256814753.7300.1.camel@marge.simson.net>
[not found] ` <20091102162056.GC15423@elte.hu>
[not found] ` <1257179120.10173.50.camel@marge.simson.net>
2009-11-10 19:12 ` [PATCH -v2] sched: Make sure task has correct sched_class after policy change Peter Zijlstra
2009-11-10 20:54 ` [tip:sched/core] " tip-bot for Peter Zijlstra
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.