I see two problems. I don't see what prevents the second (and third...)
CPU from trying to do the same thing, i.e. while CPU 1 is running over
all the tasks at the front of the list (non of which are likely to be in
the run list) CPU 2 discovers that the same recalculation needs to be
done. If I am correct the read_lock will not stop it and CPU 2 will run
down the same list doing the same thing.
The other possible outcome is the one you point out. Since all the
tasks in the run list had zero counters, save some "nice"ness, they will
all get the same new count, thus it should not matter which is picked to
run. The only problem is a possible violation of any "nice"ness.
I have been toying around with the notion of just updating the tasks in
the run list and deferring the update of all the rest until they are put
back in the run list. This would make the recalculation _much_ faster
and possibly it could be done without dropping the runqueue_lock. The
biggest draw back to it I see is that the "fair scheduler" becomes way
more difficult to implement.
George
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/