Re: [PATCH] 2.2.15 scheduler

From: Dimitris Michailidis (dimitris@cthulhu.engr.sgi.com)
Date: Mon Mar 06 2000 - 21:11:50 EST


Rik van Riel <riel@conectiva.com.br> writes:

> 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.
>
> ...
>
> --- 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).

> + p->counter = (p->counter >> 1) + p->priority;
> + }
> read_unlock(&tasklist_lock);
> spin_lock_irq(&runqueue_lock);
> goto repeat_schedule;

-- 
Dimitris Michailidis                    dimitris@engr.sgi.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:21 EST