From: tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, pwil3058@bigpond.net.au,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:sched/urgent] sched: Make sure task has correct sched_class after policy change
Date: Wed, 14 Oct 2009 13:13:54 GMT [thread overview]
Message-ID: <tip-67d08dfed042855431dc99c9e0e6f6f7e85737ef@git.kernel.org> (raw)
In-Reply-To: <1253687579.7695.89.camel@twins>
Commit-ID: 67d08dfed042855431dc99c9e0e6f6f7e85737ef
Gitweb: http://git.kernel.org/tip/67d08dfed042855431dc99c9e0e6f6f7e85737ef
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 12 Oct 2009 17:20:54 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 14 Oct 2009 15:02:35 +0200
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>
LKML-Reference: <1253687579.7695.89.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 789001d..2d7a002 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6145,23 +6145,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);
}
prev parent reply other threads:[~2009-10-14 13:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-23 2:21 [PATCH] sched: Make sure task has correct sched_class after policy change Peter Williams
2009-09-23 6:32 ` Peter Zijlstra
2009-09-23 12:40 ` Peter Williams
2009-10-12 0:36 ` Peter Williams
2009-10-12 15:34 ` Peter Zijlstra
2009-10-14 13:13 ` tip-bot for Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-67d08dfed042855431dc99c9e0e6f6f7e85737ef@git.kernel.org \
--to=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=pwil3058@bigpond.net.au \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox