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]

Reply via email to