Re: [PATCH 2/3] workqueue: not allow recursion run_workqueue

From: Peter Zijlstra
Date: Thu Jan 22 2009 - 06:10:45 EST


On Thu, 2009-01-22 at 12:06 +0100, FrÃdÃric Weisbecker wrote:

> Ok.
> Oh but I haven't seen that Oleg said he prefered bug_on, because the
> system will deadlock instead....hmm...
>
> Or perhaps keeping the things like the old way, but with a WARN_ONCE:
>
> if (cwq->thread == current) {
> /*
> * Don't ever think to flush workqueue from a work
> */
> WARN_ONCE(1);
>
> run_workqueue(cwq);
> active = 1;
> }
>
> And then, the workqueue will flush...so it will behave correctly but
> will warn on this bad developer idea of flushing from a work.

lockdep already yells at you for doing that, and developers should run
with lockdep enabled -- or at least test stuff with lockdep enabled, so
I'm not exactly seeing what this will buy us.

> Actually I don't understand when Lai says that it will actually not flush.

Yeah, his changelog is an utter mistery to many..

--
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/