diff -urN parent-ref/include/linux/sched.h parent/include/linux/sched.h --- parent-ref/include/linux/sched.h Sun Apr 15 20:51:13 2001 +++ parent/include/linux/sched.h Mon Apr 16 02:07:57 2001 @@ -305,7 +305,9 @@ int nice; unsigned int policy; struct mm_struct *mm; - int has_cpu, processor; + int has_cpu:1; + int get_child_timeslice:1; + int processor; unsigned long cpus_allowed; /* * (only the 'next' pointer fits into the cacheline, but diff -urN parent-ref/kernel/exit.c parent/kernel/exit.c --- parent-ref/kernel/exit.c Thu Feb 22 03:45:13 2001 +++ parent/kernel/exit.c Mon Apr 16 02:11:31 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->get_child_timeslice) { + 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->get_child_timeslice = 0; if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0); } } diff -urN parent-ref/kernel/fork.c parent/kernel/fork.c --- parent-ref/kernel/fork.c Sun Apr 15 20:51:13 2001 +++ parent/kernel/fork.c Mon Apr 16 02:07:47 2001 @@ -676,6 +676,8 @@ p->counter = current->counter; current->counter = 0; current->need_resched = 1; + /* Tell the parent if it can get back its timeslice when child exits */ + p->get_child_timeslice = 1; /* * Ok, add it to the run-queues and make it diff -urN parent-ref/kernel/sched.c parent/kernel/sched.c --- parent-ref/kernel/sched.c Sun Apr 15 20:51:13 2001 +++ parent/kernel/sched.c Mon Apr 16 02:09:11 2001 @@ -749,6 +749,7 @@ continue; #endif p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice); + p->get_child_timeslice = 0; } read_unlock(&tasklist_lock); spin_lock_irq(&runqueue_lock);