diff -NurP --minimal linux-2.4.23-pre4/kernel/sched.c linux-2.4.23-pre4-ctx17d/kernel/sched.c --- linux-2.4.23-pre4/kernel/sched.c 2003-09-13 00:50:17.000000000 +0200 +++ linux-2.4.23-pre4-ctx17d/kernel/sched.c 2003-09-13 17:19:02.000000000 +0200 @@ -165,7 +165,13 @@ * Don't do any other calculations if the time slice is * over.. */ - weight = p->counter; + if (p->s_info != NULL + && (p->s_info->flags & S_CTX_INFO_SCHED)) { + weight = atomic_read (&p->s_info->ticks)/p->s_info->refcount; + weight = (weight+p->counter)>>1; + } else { + weight = p->counter; + } if (!weight) goto out; @@ -618,8 +624,21 @@ spin_unlock_irq(&runqueue_lock); read_lock(&tasklist_lock); - for_each_task(p) + /* + Reset the s_info->ticks to the sum off all + member processes p->counter + */ + for_each_task(p) { + if (p->s_info != NULL + && (p->s_info->flags & S_CTX_INFO_SCHED)) + atomic_set (&p->s_info->ticks,0); + } + for_each_task(p) { p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice); + if (p->s_info != NULL + && (p->s_info->flags & S_CTX_INFO_SCHED)) + atomic_add (p->counter,&p->s_info->ticks); + } read_unlock(&tasklist_lock); spin_lock_irq(&runqueue_lock); goto repeat_schedule;