RFC for small change to 4bsd scheduler..

From: Julian Elischer <julian_at_elischer.org>
Date: Sun, 9 May 2004 19:07:28 -0700 (PDT)
in the following code:
struct kse *
sched_choose(void)
{
        struct kse *ke;
        struct runq *rq;

#ifdef SMP
        struct kse *kecpu;
            
        rq = &runq;
        ke = runq_choose(&runq);
        kecpu = runq_choose(&runq_pcpu[PCPU_GET(cpuid)]);

        if (ke == NULL ||
            (kecpu != NULL && 
**>>>>      kecpu->ke_thread->td_priority <
                ke->ke_thread->td_priority)) {
                     CTR2(KTR_4BSD, "choosing kse %p from pcpu runq %d", kecpu,
                     PCPU_GET(cpuid));
                ke = kecpu;
                rq = &runq_pcpu[PCPU_GET(cpuid)];
        } else {
                CTR1(KTR_4BSD, "choosing kse %p from main runq", ke);
        }



I think it would be better to have "<=" instead of "<"

I think the current code will make processes of equal priority thrash
processors if one is on the pcpu list and teh other is on the general
queue. as it is the pcpu process will only ever run when there is
nothing of teh same priority to run..

maybe there should be code to give such a case a 50/50 chance or
something?
Received on Sun May 09 2004 - 17:07:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:53 UTC