summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorCon Kolivas <kernel@kolivas.org>2005-11-08 21:38:56 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 07:56:32 -0800
commit738a2ccbcf8c2c1b039f1e76662dce60b22b694b (patch)
treeb7359315b135d2266cef2bcfac10347ab34a3ad9 /kernel
parentb910472dd3b7c1d51af9a594a759f642520c33e1 (diff)
downloadlinux-738a2ccbcf8c2c1b039f1e76662dce60b22b694b.tar.bz2
[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: Con Kolivas <kernel@kolivas.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index c6827f94e156..e1f57bd5aaa6 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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: