diff -urN parent-timeslice-ref/arch/alpha/kernel/entry.S parent-timeslice/arch/alpha/kernel/entry.S --- parent-timeslice-ref/arch/alpha/kernel/entry.S Sat Apr 14 15:32:43 2001 +++ parent-timeslice/arch/alpha/kernel/entry.S Sat Apr 14 15:32:55 2001 @@ -35,7 +35,7 @@ #define TASK_EXEC_DOMAIN 32 #define TASK_NEED_RESCHED 40 #define TASK_PTRACE 48 -#define TASK_PROCESSOR 100 +#define TASK_PROCESSOR 96 /* * task flags (must match include/linux/sched.h): diff -urN parent-timeslice-ref/arch/i386/kernel/entry.S parent-timeslice/arch/i386/kernel/entry.S --- parent-timeslice-ref/arch/i386/kernel/entry.S Tue Nov 28 18:39:59 2000 +++ parent-timeslice/arch/i386/kernel/entry.S Sat Apr 14 15:32:55 2001 @@ -78,7 +78,7 @@ exec_domain = 16 need_resched = 20 tsk_ptrace = 24 -processor = 52 +processor = 60 ENOSYS = 38 diff -urN parent-timeslice-ref/include/linux/sched.h parent-timeslice/include/linux/sched.h --- parent-timeslice-ref/include/linux/sched.h Sat Apr 14 15:32:43 2001 +++ parent-timeslice/include/linux/sched.h Sat Apr 14 15:32:55 2001 @@ -301,10 +301,12 @@ * 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; struct mm_struct *mm; + unsigned int policy; 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; diff -urN parent-timeslice-ref/kernel/exit.c parent-timeslice/kernel/exit.c --- parent-timeslice-ref/kernel/exit.c Thu Feb 22 03:45:13 2001 +++ parent-timeslice/kernel/exit.c Sat Apr 14 15:32:55 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 parent-timeslice-ref/kernel/fork.c parent-timeslice/kernel/fork.c --- parent-timeslice-ref/kernel/fork.c Sat Apr 14 15:32:43 2001 +++ parent-timeslice/kernel/fork.c Sat Apr 14 15:33:51 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->counter_refresh = 0; /* * Ok, add it to the run-queues and make it diff -urN parent-timeslice-ref/kernel/sched.c parent-timeslice/kernel/sched.c --- parent-timeslice-ref/kernel/sched.c Sat Apr 14 15:32:43 2001 +++ parent-timeslice/kernel/sched.c Sat Apr 14 15:32:55 2001 @@ -757,6 +757,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);