I am testing this on my quad xeon, and it does look better.  IE a compute
bound process seems to stick on one cpu for long periods of time.  It will
occasionally move, when the process does an I/O, but it is far better than
it was, in that running xosview would show a single process bouncing
around quite frequently...

I'll leave this in and burn it for a while to see if anything goes sour,
but it looks reasonable so far...


Robert Hyatt                    Computer and Information Sciences
[EMAIL PROTECTED]               University of Alabama at Birmingham
(205) 934-2213                  115A Campbell Hall, UAB Station 
(205) 934-5473 FAX              Birmingham, AL 35294-1170

On Mon, 21 Dec 1998, Rik van Riel wrote:

> Hi,
> 
> I have made what I believe to be a better, lower-overhead
> reschedule_idle() and goodness() that should fix quite a
> bit of the current SMP scheduling problems.
> 
> static inline void reschedule_idle(struct task_struct * p)
> {
> #ifdef SMP
>         if (p->processor == current->processor && (p->rt_priority ||
>                         p->counter > current->counter + 3))
>                 current->need_resched = 1;
>         else if (p->counter >= ((DEF_PRIORITY * 2) / 3) || p->rt_priority)
>                 smp_send_reschedule(p->processor);
> #else
>       if (p->rt_priority || p->counter > current->counter + 3)
>               current->need_resched = 1;
> #endif
> }
> 
> If the process is not from the current CPU, we use a very
> simple algorithm (avoiding expensive cross-CPU communication)
> to determine if we should reschedule that CPU or not.
> 
> And in goodness() I changed the PROC_CHANGE_PENALTY stuff to this:
> 
>                 if (p->processor != this_cpu) {
>                         weight -= PROC_CHANGE_PENALTY;
>                         return weight;
>                 }
> 
> The advantage of this piece of code is that processor binding
> now still works if the process on the current CPU runs out of
> it's timeslice (counter == 0) and a process on another CPU is
> interrupted in the middle of it's slice.
> 
> In my kernel tree it's a bit more complex (because of SCHED_IDLE
> stuff), but this simpler piece of code should work OK...
> 
> regards,
> 
> Rik -- the flu hits, the flu hits, the flu hits -- MORE
> +-------------------------------------------------------------------+
> | Linux memory management tour guide.        [EMAIL PROTECTED] |
> | Scouting Vries cubscout leader.      http://www.phys.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]
> 

-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]

Reply via email to