diff -urNp o1-sched-ref/include/linux/sched.h o1-sched/include/linux/sched.h --- o1-sched-ref/include/linux/sched.h Wed May 29 17:36:11 2002 +++ o1-sched/include/linux/sched.h Wed May 29 17:36:32 2002 @@ -371,6 +371,7 @@ struct task_struct { unsigned long policy; unsigned long cpus_allowed; unsigned int time_slice; + int get_child_timeslice; task_t *next_task, *prev_task; diff -urNp o1-sched-ref/kernel/exit.c o1-sched/kernel/exit.c --- o1-sched-ref/kernel/exit.c Wed May 29 17:36:10 2002 +++ o1-sched/kernel/exit.c Wed May 29 17:36:32 2002 @@ -231,6 +231,7 @@ static inline void forget_original_paren else p->p_opptr = reaper; + p->get_child_timeslice = 0; if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0); } } diff -urNp o1-sched-ref/kernel/fork.c o1-sched/kernel/fork.c --- o1-sched-ref/kernel/fork.c Wed May 29 17:36:21 2002 +++ o1-sched/kernel/fork.c Wed May 29 17:36:49 2002 @@ -729,6 +729,8 @@ int do_fork(unsigned long clone_flags, u } p->sleep_timestamp = jiffies; __sti(); + /* 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 -urNp o1-sched-ref/kernel/sched.c o1-sched/kernel/sched.c --- o1-sched-ref/kernel/sched.c Wed May 29 17:36:21 2002 +++ o1-sched/kernel/sched.c Wed May 29 17:36:32 2002 @@ -360,9 +360,11 @@ void wake_up_forked_process(task_t * p) void sched_exit(task_t * p) { __cli(); - current->time_slice += p->time_slice; - if (unlikely(current->time_slice > MAX_TIMESLICE)) - current->time_slice = MAX_TIMESLICE; + if (p->get_child_timeslice) { + current->time_slice += p->time_slice; + if (unlikely(current->time_slice > MAX_TIMESLICE)) + current->time_slice = MAX_TIMESLICE; + } __sti(); /* * If the child was a (relative-) CPU hog then decrease @@ -673,6 +675,7 @@ void scheduler_tick(int user_tick, int s */ if ((p->policy == SCHED_RR) && !--p->time_slice) { p->time_slice = TASK_TIMESLICE(p); + p->get_child_timeslice = 0; set_tsk_need_resched(p); /* put it at the end of the queue: */ @@ -696,6 +699,7 @@ void scheduler_tick(int user_tick, int s set_tsk_need_resched(p); p->prio = effective_prio(p); p->time_slice = TASK_TIMESLICE(p); + p->get_child_timeslice = 0; if (!TASK_INTERACTIVE(p) || EXPIRED_STARVING(rq)) { if (!rq->expired_timestamp)