[PATCH] 2.2.15 scheduler

From: Rik van Riel (riel@conectiva.com.br)
Date: Mon Mar 06 2000 - 13:57:05 EST


Hi Alan,

here's a small patch that will avoid dirtying the cache line
holding p->counter for > 90% of the tasks in the priority
recalculation of the scheduler.

For 90% of the tasks (which are sleeping and don't need their
priority recalculated) this means they'll take the early
branch and jump back to for_each_task(), the remaining < 10%
of the tasks will have to go through the priority recalculation.

This should keep process priority calculation a little more cache
friendly, especially on those 128kB L2 cache machines that everybody
seems to be using these days ...

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/

--- 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) + p->counter = (p->counter >> 1) + p->priority; + } read_unlock(&tasklist_lock); spin_lock_irq(&runqueue_lock); goto repeat_schedule;

- 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:20 EST