--- linux/kernel/sched.c.orig Thu Nov 8 11:06:31 2001 +++ linux/kernel/sched.c Thu Nov 8 11:07:22 2001 @@ -703,6 +703,7 @@ move_rr_last: if (!prev->counter) { prev->counter = NICE_TO_TICKS(prev->nice); + prev->timer_ticks = 0; move_last_runqueue(prev); } goto move_rr_back; --- linux/kernel/timer.c.orig Thu Nov 8 11:06:29 2001 +++ linux/kernel/timer.c Thu Nov 8 11:07:22 2001 @@ -583,8 +583,9 @@ update_one_process(p, user_tick, system, cpu); if (p->pid) { - if (--p->counter <= 0) { + if (++p->timer_ticks >= p->counter) { p->counter = 0; + p->timer_ticks = 0; p->need_resched = 1; } if (p->nice > 0) --- linux/kernel/fork.c.orig Thu Nov 8 11:06:26 2001 +++ linux/kernel/fork.c Thu Nov 8 11:07:22 2001 @@ -681,11 +681,17 @@ * total amount of dynamic priorities in the system doesnt change, * more scheduling fairness. This is only important in the first * timeslice, on the long run the scheduling behaviour is unchanged. + * + * also share the timer tick counter. */ p->counter = (current->counter + 1) >> 1; current->counter >>= 1; - if (!current->counter) + p->timer_ticks = (current->timer_ticks + 1) >> 1; + current->timer_ticks >>= 1; + if (!current->counter) { current->need_resched = 1; + current->timer_ticks = 0; + } /* * Ok, add it to the run-queues and make it --- linux/kernel/exit.c.orig Thu Nov 8 11:06:31 2001 +++ linux/kernel/exit.c Thu Nov 8 11:07:22 2001 @@ -60,10 +60,19 @@ * (this cannot be used to artificially 'generate' * timeslices, because any timeslice recovered here * was given away by the parent in the first place.) + * + * Also retrieve timeslice ticks. */ current->counter += p->counter; - if (current->counter >= MAX_COUNTER) + current->timer_ticks += p->timer_ticks; + if (current->counter >= MAX_COUNTER) { current->counter = MAX_COUNTER; + if (current->timer_ticks >= current->counter) { + current->counter = 0; + current->timer_ticks = 0; + current->need_resched = 1; + } + } p->pid = 0; free_task_struct(p); } else { --- linux/mm/oom_kill.c.orig Thu Nov 8 11:06:33 2001 +++ linux/mm/oom_kill.c Thu Nov 8 11:07:48 2001 @@ -150,6 +150,7 @@ * exit() and clear out its resources quickly... */ p->counter = 5 * HZ; + p->timer_ticks = 0; p->flags |= PF_MEMALLOC | PF_MEMDIE; /* This process has hardware access, be more careful. */ --- linux/include/linux/sched.h.orig Thu Nov 8 11:06:33 2001 +++ linux/include/linux/sched.h Thu Nov 8 12:17:54 2001 @@ -312,6 +312,7 @@ */ struct list_head run_list; unsigned long sleep_time; + long timer_ticks; struct task_struct *next_task, *prev_task; struct mm_struct *active_mm; --- linux/drivers/net/slip.c.orig Thu Nov 8 12:18:52 2001 +++ linux/drivers/net/slip.c Thu Nov 8 12:19:16 2001 @@ -1395,6 +1395,7 @@ do { if (busy) { current->counter = 0; + current->timer_ticks = 0; schedule(); }