On Tuesday 15 July 2008 11:11:34 Hidetoshi Seto wrote:
Hi Hidetoshi,
OK, if you are worried about that race, I think we can still fix it...
What if we use:
if (i != smp_processor_id() && !cpu_test_and_set(i, prepared_cpus)) {
instead of cpu_isset? That means that if a CPU restarts during that window,
either the thread will exit (because we set the bit here), or this will
detect it.
Hmm, there's still the vague possibility that the thread doesn't schedule
until we start a new stop_machine (and clear prepared_cpus). We could simply
loop in the main thread if any threads are alive, before freeing them (inside
the lock). A counter and notifier is the other way, but it seems like
overkill for a very unlikely event.
Thanks for the analysis!
Rusty.
--