lkml.org 
[lkml]   [2009]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] workqueue: not allow recursion run_workqueue
On 01/21, Peter Zijlstra wrote:
>
> On Wed, 2009-01-21 at 17:42 +0800, Lai Jiangshan wrote:
> > 1) lockdep will complain when recursion run_workqueue
> > 2) works is not run orderly when recursion run_workqueue
> >
> > 3) BUG!
> > We use recursion run_workqueue to hidden deadlock when
> > keventd trying to flush its own queue.
> >
> > It's bug. When flush_workqueue()(nested in a work callback)returns,
> > the workqueue is not really flushed, the sequence statement of
> > this work callback will do some thing bad.
> >
> > So we should not allow workqueue trying to flush its own queue.
>
> The patch looks good, but I'm utterly failing to comprehend this
> changelog. What exactly can go wrong (other than the obvious too deep
> nest and the fact that lockdep will complain)?

I am confused too.


But the change itself looks good to me, I am only worried if we still
have the callers of flush() from within work->func().

> + WARN_ON(cwq->thread == current);

probably BUG_ON() is better, we are going to deadlock in this case.

Oleg.



\
 
 \ /
  Last update: 2009-01-21 13:51    [W:0.070 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site