Index: linux-2.6.10-rc3-ck2/include/linux/sched.h =================================================================== --- linux-2.6.10-rc3-ck2.orig/include/linux/sched.h 2004-12-21 12:22:47.606586416 +1100 +++ linux-2.6.10-rc3-ck2/include/linux/sched.h 2004-12-21 12:40:57.377915992 +1100 @@ -753,7 +753,7 @@ extern int task_nice(const task_t *p); extern int task_curr(const task_t *p); extern int idle_cpu(int cpu); -extern unsigned long task_will_schedule_at(const task_t *p); +extern unsigned long task_will_schedule_at(task_t *p); void yield(void); Index: linux-2.6.10-rc3-ck2/kernel/sched.c =================================================================== --- linux-2.6.10-rc3-ck2.orig/kernel/sched.c 2004-12-21 11:58:59.598676616 +1100 +++ linux-2.6.10-rc3-ck2/kernel/sched.c 2004-12-21 12:40:03.334131896 +1100 @@ -82,6 +82,7 @@ */ #define _RR_INTERVAL ((10 * HZ / 1000) ? : 1) #define RR_INTERVAL() (_RR_INTERVAL * (1 + 9 * sched_compute)) +#define MAX_TIMESLICE ((RR_INTERVAL()) * 40) #define task_hot(p, now, sd) ((long long) ((now) - (p)->timestamp) \ < (long long) (sd)->cache_hot_time) @@ -750,7 +751,7 @@ * task_will_schedule_at - in how many ticks will the task run, most likely * @p: the task in question */ -unsigned long task_will_schedule_at(const task_t *p) +unsigned long task_will_schedule_at(task_t *p) { /* * Task is executing right now @@ -766,16 +767,14 @@ * that is due to us dereferencing the current task without * locking) */ - if (p->array) - return min(cpu_curr(task_cpu(p))->time_slice, - (unsigned int)MAX_SLEEP_AVG); + if (task_queued(p)) + return min(cpu_curr(task_cpu(p))->slice, + (unsigned int)MAX_TIMESLICE); /* - * for blocked tasks, return half of the average sleep time. - * (because this is the average sleep-time we'll see if we - * sample the period randomly.) + * for blocked tasks, return the average sleep time. */ - return NS_TO_JIFFIES(p->sleep_avg) / 2; + return p->burst * RR_INTERVAL(); } EXPORT_SYMBOL_GPL(task_will_schedule_at);