public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: not allow recursion run_workqueue
Date: Wed, 21 Jan 2009 13:45:14 +0100	[thread overview]
Message-ID: <20090121124514.GA13404@redhat.com> (raw)
In-Reply-To: <1232536373.4847.115.camel@laptop>

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.


  reply	other threads:[~2009-01-21 12:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-21  9:42 [PATCH] workqueue: not allow recursion run_workqueue Lai Jiangshan
2009-01-21 10:56 ` Ingo Molnar
2009-01-21 11:12 ` Peter Zijlstra
2009-01-21 12:45   ` Oleg Nesterov [this message]
2009-01-22  6:03   ` Lai Jiangshan
2009-01-22  9:52     ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090121124514.GA13404@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox