提交 738a2ccb 编写于 作者: C Con Kolivas 提交者: Linus Torvalds

[PATCH] sched: change prio bias only if queued

prio_bias should only be adjusted in set_user_nice if p is actually currently
queued.
Signed-off-by: NCon Kolivas <kernel@kolivas.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b910472d
......@@ -3508,25 +3508,24 @@ void set_user_nice(task_t *p, long nice)
* not SCHED_NORMAL:
*/
if (rt_task(p)) {
dec_prio_bias(rq, p->static_prio);
p->static_prio = NICE_TO_PRIO(nice);
inc_prio_bias(rq, p->static_prio);
goto out_unlock;
}
array = p->array;
if (array)
if (array) {
dequeue_task(p, array);
dec_prio_bias(rq, p->static_prio);
}
old_prio = p->prio;
new_prio = NICE_TO_PRIO(nice);
delta = new_prio - old_prio;
dec_prio_bias(rq, p->static_prio);
p->static_prio = NICE_TO_PRIO(nice);
inc_prio_bias(rq, p->static_prio);
p->prio += delta;
if (array) {
enqueue_task(p, array);
inc_prio_bias(rq, p->static_prio);
/*
* If the task increased its priority or is running and
* lowered its priority, then reschedule its CPU:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册