Index: linux-2.6.8-rc3/kernel/sched.c =================================================================== --- linux-2.6.8-rc3.orig/kernel/sched.c 2004-08-08 22:53:55.599598669 +1000 +++ linux-2.6.8-rc3/kernel/sched.c 2004-08-08 22:55:48.012663027 +1000 @@ -325,20 +325,23 @@ static void recalc_task_prio(task_t *p, unsigned long long now) { unsigned long sleep_time = now - p->timestamp; - unsigned long ns_totalrun = p->totalrun + p->runtime; - unsigned long total_run = NS_TO_JIFFIES(ns_totalrun); + unsigned int rr = RR_INTERVAL(); if (p->flags & PF_FORKED || - (NS_TO_JIFFIES(p->runtime + sleep_time) < - RR_INTERVAL() / 2 || ((!sched_interactive || - sched_compute) && NS_TO_JIFFIES(p->runtime + sleep_time) < - RR_INTERVAL()))) { + (NS_TO_JIFFIES(p->runtime + sleep_time) < rr / 2 || + ((!sched_interactive || sched_compute) && + NS_TO_JIFFIES(p->runtime + sleep_time) < rr))) { + unsigned long ns_totalrun = p->totalrun + p->runtime; + unsigned long total_run = NS_TO_JIFFIES(ns_totalrun); p->flags &= ~PF_FORKED; if (p->slice - total_run < 1) { p->totalrun = 0; dec_burst(p); } else { + unsigned int intervals = total_run / rr; p->totalrun = ns_totalrun; - p->slice -= total_run; + p->slice -= intervals * rr; + if (p->slice <= rr) + p->totalrun = 0; } } else { if (!(p->flags & PF_UISLEEP))