Re: Singlethread vs. freezable workqueues

Oleg Nesterov
2007-05-21T20:54:09Z

On 05/21, Rafael J. Wysocki wrote:
>
> On Monday, 21 May 2007 21:33, Alan Stern wrote:
> > Raphael:
> >
> > Are we now committed to making freezable workqueues always
> > singlethreaded? Is it at all likely to change back? Or should I
> > introduce a "create_singlethread_freezeable_workqueue" macro?
>
> This was done as a quick fix of an issue with one driver that started to use
> (broken) freezable workqueues when we were not watching. ;-)
>
> We are going to have multithread freezable workqueues as well, but that'll
> take some time. We've discussed this a bit with Oleg and I believe he has an
> idea of how it can be done cleanly.

No, I don't have an idea how to do this cleanly currently.

We can fix them right now with Rafael's "take_over_work() + migrate_sequence"
patch, feel free to send it. Not perfect, but should work.

Perhaps it makes sense to make some other changes first. For example, kill
CPU_TASKS_FROZEN bit.

Next. We can't make all wqs freezeable, but if we add freezer_exempt/PF_FE_XXX
we can freeze them all for cpu_up/cpu_down, this also make things simpler.

Note that we don't have a good way to use take_over_work() for !freezeable wq.
2.6.21 does kthread_stop() first, this is deadlockable because we may have
a work_struct on ->worklist which also calls kthread_stop(). Perhaps it makes
sense to wait until kthread_stop() will be reworked (should be soon).

Perhaps we can think a bit more :)

Oleg.