lkml.org 
[lkml]   [2000]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 2.2.15 scheduler
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.041 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site