diff -urN ref/include/linux/sched.h parent-timeslice/include/linux/sched.h --- ref/include/linux/sched.h Thu May 3 18:17:42 2001 +++ parent-timeslice/include/linux/sched.h Thu May 3 18:17:56 2001 @@ -315,6 +315,7 @@ #ifdef CONFIG_NUMA_SCHED int nid; #endif + int get_child_timeslice; struct task_struct *next_task, *prev_task; struct mm_struct *active_mm; diff -urN ref/kernel/exit.c parent-timeslice/kernel/exit.c --- ref/kernel/exit.c Thu Feb 22 03:45:13 2001 +++ parent-timeslice/kernel/exit.c Thu May 3 18:17:56 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 ref/kernel/fork.c parent-timeslice/kernel/fork.c --- ref/kernel/fork.c Thu May 3 18:17:42 2001 +++ parent-timeslice/kernel/fork.c Thu May 3 18:18:31 2001 @@ -675,6 +675,9 @@ if (!current->counter) 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 * visible to the rest of the system. diff -urN ref/kernel/sched.c parent-timeslice/kernel/sched.c --- ref/kernel/sched.c Thu May 3 18:17:42 2001 +++ parent-timeslice/kernel/sched.c Thu May 3 18:17:56 2001 @@ -752,6 +752,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);