On 6 Mar 2000, Dimitris Michailidis wrote:
> Rik van Riel <riel@conectiva.com.br> writes:
>
> > --- linux-2.2.14/kernel/sched.c.orig Mon Mar 6 15:27:42 2000
> > +++ linux-2.2.14/kernel/sched.c Mon Mar 6 15:31:03 2000
> > @@ -833,8 +833,11 @@
> > struct task_struct *p;
> > spin_unlock_irq(&runqueue_lock);
> > read_lock(&tasklist_lock);
> > - for_each_task(p)
> > - p->counter = (p->counter >> 1) + p->priority;
> > + for_each_task(p) {
> > + /* don't dirty a cache line if we don't have to */
> > + if (p->counter != p->priority * 2)
>
> This test is always true. The max counter value is 2 * priority - 1
> (geometric progression and all).
Oops, indeed. I was fooled by the output of top and
the stats in /proc which loses the least significant
bit.
+ if (p->counter >> 1 != p->priority)
That would be better (and avoid cacheline pingpong on
SMP machines with multiple niced processes .. think
distributed.net).
> > + p->counter = (p->counter >> 1) + p->priority;
> > + }
> > read_unlock(&tasklist_lock);
> > spin_lock_irq(&runqueue_lock);
> > goto repeat_schedule;
regards,
Rik
-- The Internet is not a network of computers. It is a network of people. That is its real strength.http://www.conectiva.com/ http://www.surriel.com/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:22 EST