Elijah Buck wrote:
Hi,
I'm looking at the code for 4bsd fuzzy run queues in kern_switch.c
The relevant bit:
if (fuzz > 1) {
int count = fuzz;
int cpu = PCPU_GET(cpuid);
struct thread *td2;
td2 = td = TAILQ_FIRST(rqh);
while (count-- && td2) {
if (td->td_lastcpu == cpu) {
this should be td2. The bug is mine..
and I wondered why the code commited never had the same result as that
I tested in another tree.
td = td2;
break;
}
td2 = TAILQ_NEXT(td2, td_runq);
}
...return(td)
The purpose of this code appears to be to look through the runq to a depth
defined by fuzz for a thread that was last run on the current cpu.
Here are the cases I see:
1.) if (td_lastcpu == cpu) on the first iteration then TAILQ_FIRST(rqh) is
the selected thread (because of the break).
2.) if (td_lastcpu != cpu) on the first iteration then td is never set
again, and so (td_lastcpu != cpu) is always true. So, again,
TAILQ_FIRST(rqh) will be selected (because count will reach 0).
Which doesn't seem right (since that's what the else clause does). What am I
missing here?
Thanks,
Elijah
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"