Re: [PATCH] flush_cpu_workqueue: don't flush an empty ->worklist

From: Oleg Nesterov
Date: Tue Jan 09 2007 - 10:09:03 EST


On 01/08, Andrew Morton wrote:
>
> That's not correct. freeze_processes() will freeze *all* processes. All
> of them are forced to enter refrigerator(). With the mysterious exception
> of some I/O-related kernel threads, which might need some thought.

Yes, and we can remove a dead CPU safely, this part is ok.

> > and
> > http://marc.theaimsgroup.com/?l=linux-kernel&m=116817460726058.
>
> Am not sure how that's related.

but at some point we should thaw processes, including cwq->thread which
should die. So we are doing things like take_over_work() and this is the
source of races, because the dead CPU is not on cpu_online_map.

flush_workqueue() doesn't use any locks now. If we use freezer to implement
cpu-hotplug nothing will change, we still have races.

It looks so obvious to me, so I'm starting to suspect I missed something
very simple :(

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/