diff -urN 2.4.5pre1/include/linux/sched.h parent-timeslice/include/linux/sched.h --- 2.4.5pre1/include/linux/sched.h Tue May 1 19:35:32 2001 +++ parent-timeslice/include/linux/sched.h Tue May 8 01:03:49 2001 @@ -311,8 +311,8 @@ * that's just fine.) */ struct list_head run_list; - unsigned long sleep_time; + int get_child_timeslice; struct task_struct *next_task, *prev_task; struct mm_struct *active_mm; @@ -839,7 +839,6 @@ static inline void del_from_runqueue(struct task_struct * p) { nr_running--; - p->sleep_time = jiffies; list_del(&p->run_list); p->run_list.next = NULL; } diff -urN 2.4.5pre1/kernel/exit.c parent-timeslice/kernel/exit.c --- 2.4.5pre1/kernel/exit.c Thu Feb 22 03:45:13 2001 +++ parent-timeslice/kernel/exit.c Tue May 8 01:03:36 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 2.4.5pre1/kernel/fork.c parent-timeslice/kernel/fork.c --- 2.4.5pre1/kernel/fork.c Wed May 2 10:11:42 2001 +++ parent-timeslice/kernel/fork.c Tue May 8 01:03:36 2001 @@ -676,6 +676,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 2.4.5pre1/kernel/sched.c parent-timeslice/kernel/sched.c --- 2.4.5pre1/kernel/sched.c Tue May 1 19:35:33 2001 +++ parent-timeslice/kernel/sched.c Tue May 8 01:03:36 2001 @@ -681,8 +681,10 @@ struct task_struct *p; spin_unlock_irq(&runqueue_lock); read_lock(&tasklist_lock); - for_each_task(p) + for_each_task(p) { p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice); + p->get_child_timeslice = 0; + } read_unlock(&tasklist_lock); spin_lock_irq(&runqueue_lock); }