mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Anirban Sinha <ASinha@zeugmasystems.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: FW: avoiding run_workqueue() recursion
Date: Wed, 15 Jul 2009 20:39:41 +0200	[thread overview]
Message-ID: <20090715183941.GA13341@redhat.com> (raw)
In-Reply-To: <DDFD17CC94A9BD49A82147DDF7D545C501CFAE3D@exchange.ZeugmaSystems.local>

Hi Anirban,

On 07/14, Anirban Sinha wrote:
>
> >I had a question about one of your previous commits:
> >
> >: commit 2355b70fd59cb5be7de2052a9edeee7afb7ff099
> >: Author: Lai Jiangshan <laijs@cn.fujitsu.com>
> >: Date:   Thu Apr 2 16:58:24 2009 -0700
> >:
> >:    workqueue: avoid recursion in run_workqueue()
> >
> >http://git.kernel.org/linus/2355b70fd59cb5be7de2052a9edeee7afb7ff099
> >
> >
> >I saw a few discussions on the mailing list around this. I also did see
> >your "I still don't know why I merged ..." comment on this. I have the
> >following observations. I am new in the kernel hacking world, so please
> >bear with me.
> >
> >(a) I do agree that flushing the work queues from within
> run_workqueue()
> >is buggy in itself.
> >
> >(b) I do also agree that recursive call to run_workqueue() is bad due
> to
> >the reasons cited in the commit log (even though I had a good laugh
> when
> >I saw the "morton gets to eat his hat" stuff :)).
> >
> >(c) I am a little puzzled by the change the patch made. If we let the
> >call sleep on completion when keventd is itself running the
> >flush_workqueue(), are we not introducing a deadlock? If the thread
> that
> >is itself is responsible for walking the workqueue and dispatching the
> >work functions goes to sleep, who will wake it up?

Yes, this will deadlock. Note the WARN_ON().

> >In my honest opinion, I think we should simply return when (cwq->thread
> >== current) is true. I think in that condition,  it should be just a
> >nop.

If we just return silently, we do not flush but hide the problem ?
And in this can lead to other problems which are very hard to
trigger/debug.

Oleg.


       reply	other threads:[~2009-07-15 18:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DDFD17CC94A9BD49A82147DDF7D545C501CFAE3D@exchange.ZeugmaSystems.local>
2009-07-15 18:39 ` Oleg Nesterov [this message]
2009-07-15 18:52   ` Anirban Sinha

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=20090715183941.GA13341@redhat.com \
    --to=oleg@redhat.com \
    --cc=ASinha@zeugmasystems.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®