Hi,
I've had quite a bit of trouble with my previous
attempt at processor binding (mainly because the
SMP message passing didn't work) and have come
up with a new (and probably better) goal:
- tasks should have a bit of CPU binding
- low-priority tasks should easily move
out of the way of important ones
This is achieved by changing goodness():
{
int policy = p->policy;
int weight;
if (policy & SCHED_YIELD) {
p->policy = policy & ~SCHED_YIELD;
return 0;
}
/*
* Give the process a first-approximation goodness value
* according to the number of clock-ticks it has left.
*
* Don't do any other calculations if the time slice is
* over..
*/
weight = p->counter;
if (weight) {
#ifdef __SMP__
/* Give a largish advantage to the same processor... */
/* (this is equivalent to penalizing other processors) */
if (p->processor == this_cpu)
#endif
{ weight += p->priority; }
/* .. and a slight advantage to the current thread */
if (p->mm == prev->mm)
weight += 1;
}
return weight;
}
OK, this goodness() is not what you're used to -- this is
because I've got a separate code path for SCHED_IDLE and
SCHED_{FIFO,RR} tasks in my tree...
I haven't tested this idea yet, but for some strange
reason I believe it could actually work as advertized :)
cheers,
Rik -- If a Microsoft product fails, who do you sue?
+-------------------------------------------------------------------+
| Linux memory management tour guide. [EMAIL PROTECTED] |
| Scouting Vries cubscout leader. http://humbolt.geo.uu.nl/~riel |
+-------------------------------------------------------------------+
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]