Re: [PATCH] kernel <linux-2.6.11.10> kernel/sched.c

From: Ingo Molnar
Date: Fri May 20 2005 - 04:57:21 EST



* chen Shang <shangcs@xxxxxxxxx> wrote:

> I minimized my patch and against to 2.6.12-rc4 this time, see below.

looks good - i've done some small style/whitespace cleanups and renamed
prio to old_prio, patch against -rc4 below.

Ingo

From: Chen Shang <shangcs@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -2613,7 +2613,7 @@ asmlinkage void __sched schedule(void)
struct list_head *queue;
unsigned long long now;
unsigned long run_time;
- int cpu, idx;
+ int cpu, idx, old_prio;

/*
* Test if we are atomic. Since do_exit() needs to call into
@@ -2735,9 +2735,15 @@ go_idle:
delta = delta * (ON_RUNQUEUE_WEIGHT * 128 / 100) / 128;

array = next->array;
- dequeue_task(next, array);
+ old_prio = next->prio;
+
recalc_task_prio(next, next->timestamp + delta);
- enqueue_task(next, array);
+
+ if (unlikely(old_prio != next->prio)) {
+ dequeue_task(next, array);
+ enqueue_task(next, array);
+ } else
+ requeue_task(next, array);
}
next->activated = 0;
switch_tasks:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/