Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[tip:sched/core] sched: Make sure task has correct sched_class after policy change

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


peterz at infradead

Nov 10, 2009, 12:54 PM

Post #1 of 1 (61 views)
Permalink
[tip:sched/core] sched: Make sure task has correct sched_class after policy change

Commit-ID: ffd44db5f02af32bcc25a8eb5981bf02a141cdab
Gitweb: http://git.kernel.org/tip/ffd44db5f02af32bcc25a8eb5981bf02a141cdab
Author: Peter Zijlstra <peterz [at] infradead>
AuthorDate: Tue, 10 Nov 2009 20:12:01 +0100
Committer: Ingo Molnar <mingo [at] elte>
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 [at] bigpond>
Signed-off-by: Peter Zijlstra <a.p.zijlstra [at] chello>
Cc: Mike Galbraith <efault [at] gmx>
LKML-Reference: <1257880321.4108.457.camel [at] lapto>
Signed-off-by: Ingo Molnar <mingo [at] elte>
---
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);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.