Index: linux-2.6.14-ck4/kernel/sched.c =================================================================== --- linux-2.6.14-ck4.orig/kernel/sched.c 2005-11-09 20:58:22.000000000 +1100 +++ linux-2.6.14-ck4/kernel/sched.c 2005-11-09 20:58:27.000000000 +1100 @@ -16,9 +16,9 @@ * by Davide Libenzi, preemptible kernel bits by Robert Love. * 2003-09-03 Interactivity tuning by Con Kolivas. * 2004-04-02 Scheduler domains code by Nick Piggin - * 2005-09-16 New staircase scheduling policy by Con Kolivas with help + * 2005-11-02 New staircase scheduling policy by Con Kolivas with help * from William Lee Irwin III, Zwane Mwaikambo & Peter Williams. - * Staircase v12.1 + * Staircase v12.2 */ #include @@ -779,7 +779,11 @@ static inline void recalc_task_prio(task NS_TO_JIFFIES(sleep_time) < p->slice) { p->flags &= ~PF_NONSLEEP; dec_burst(p); - p->totalrun += sleep_time - JIFFIES_TO_NS(p->slice); + p->totalrun -= JIFFIES_TO_NS(p->slice); + if (sleep_time > p->totalrun) + p->totalrun = 0; + else + p->totalrun -= sleep_time; goto out; } @@ -3431,6 +3435,8 @@ void set_user_nice(task_t *p, long nice) delta = new_prio - old_prio; p->static_prio = NICE_TO_PRIO(nice); p->prio += delta; + if (p->burst > burst(p)) + p->burst = burst(p); if (queued) { enqueue_task(p, rq);