RFC for small change to 4bsd scheduler..
Julian Elischer
julian at elischer.org
Sun May 9 19:07:31 PDT 2004
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?
More information about the freebsd-current
mailing list