diff -urN 2.4.3aa/kernel/exit.c 2.4.3aa-counter-refresh/kernel/exit.c --- 2.4.3aa/kernel/exit.c Wed Feb 21 18:45:13 2001 +++ 2.4.3aa-counter-refresh/kernel/exit.c Sun Apr 1 12:43:40 2001 @@ -59,9 +59,11 @@ * timeslices, because any timeslice recovered here * was given away by the parent in the first place.) */ - current->counter += p->counter; - if (current->counter >= MAX_COUNTER) - current->counter = MAX_COUNTER; + if (!p->counter_refresh) { + current->counter += p->counter; + if (current->counter >= MAX_COUNTER) + current->counter = MAX_COUNTER; + } free_task_struct(p); } else { printk("task releasing itself\n"); @@ -168,6 +170,7 @@ p->exit_signal = SIGCHLD; p->self_exec_id++; p->p_opptr = reaper; + p->counter_refresh = 1; if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0); } } diff -urN 2.4.3aa/kernel/fork.c 2.4.3aa-counter-refresh/kernel/fork.c --- 2.4.3aa/kernel/fork.c Sun Apr 1 12:41:00 2001 +++ 2.4.3aa-counter-refresh/kernel/fork.c Sun Apr 1 12:43:40 2001 @@ -674,6 +674,8 @@ current->counter >>= 1; if (!current->counter) current->need_resched = 1; + /* Tell the parent if it can get back its timeslice when child exits */ + p->counter_refresh = 0; /* * Ok, add it to the run-queues and make it diff -urN 2.4.3aa/kernel/sched.c 2.4.3aa-counter-refresh/kernel/sched.c --- 2.4.3aa/kernel/sched.c Sun Apr 1 11:52:13 2001 +++ 2.4.3aa-counter-refresh/kernel/sched.c Sun Apr 1 12:44:19 2001 @@ -758,6 +758,7 @@ continue; #endif p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice); + p->counter_refresh = 1; } read_unlock(&tasklist_lock); spin_lock_irq(&runqueue_lock); --- 2.4.3aa/include/linux/sched.h.~1~ Sun Apr 1 13:12:50 2001 +++ 2.4.3aa/include/linux/sched.h Sun Apr 1 15:11:51 2001 @@ -301,9 +301,11 @@ * all fields in a single cacheline that are needed for * the goodness() loop in schedule(). */ - long counter; - long nice; - unsigned long policy; + int counter; + int counter_refresh; + int nice; + unsigned long rt_priority; + unsigned int policy; struct mm_struct *mm; int has_cpu, processor, nid; unsigned long cpus_allowed; @@ -346,7 +348,6 @@ wait_queue_head_t wait_chldexit; /* for wait4() */ struct semaphore *vfork_sem; /* for vfork() */ - unsigned long rt_priority; unsigned long it_real_value, it_prof_value, it_virt_value; unsigned long it_real_incr, it_prof_incr, it_virt_incr; struct timer_list real_timer;