PATCH(?): linux-2.4.4-pre2: fork should run child first
Quoted 11 lines · Hubertus Franke
Try this ... this will guarantee that (
p->counter) > (current->counter) and it seems not as radicalp->counter = (current->counter + 1) >> 1; current->counter = (current->counter - 1) >> 1; if (!current->counter) current->need_resched = 1;instead of this
Review
Quoted 7 lines
(quoted diff) +3
-4- p->counter = (current->counter + 1) >> 1; - current->counter >>= 1; - if (!current->counter) - current->need_resched = 1; + p->counter = current->counter; + current->counter = 0; + current->need_resched = 1;
No. I tried your change and also tried it with settingcurrent->need_resched to 1 in all cases, and it still seems to run the parent first in at least half of the tries. Evidently, current->counter must be zero to make the currently running process give up the CPU immediately, which is the important thing (so that the parent does not touch its virtual memory for a while).
Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104 [email protected] \ / San Jose, California 95129-1034 +1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."