From: Michal Schmidt <mschmidt@redhat.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Srivatsa Vaddagiri <vatsa@in.ibm.com>,
stable@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] destroy_workqueue() can livelock
Date: Fri, 13 Jul 2007 19:03:18 +0200 [thread overview]
Message-ID: <4697B056.9080508@redhat.com> (raw)
In-Reply-To: <20070713131655.GA1033@tv-sign.ru>
Oleg Nesterov wrote:
> Pointed out by Michal Schmidt <mschmidt@redhat.com>.
>
> The bug was introduced in 2.6.22 by me.
>
> cleanup_workqueue_thread() does flush_cpu_workqueue(cwq) in a loop until
> ->worklist becomes empty. This is live-lockable, a re-niced caller can
> get CPU after wake_up() and insert a new barrier before the lower-priority
> cwq->thread has a chance to clear ->current_work.
>
> Change cleanup_workqueue_thread() to do flush_cpu_workqueue(cwq) only once.
> We can rely on the fact that run_workqueue() won't return until it flushes
> all works. So it is safe to call kthread_stop() after that, the "should stop"
> request won't be noticed until run_workqueue() returns.
>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
I confirm the patch fixes the bug I was seeing.
Michal
prev parent reply other threads:[~2007-07-13 17:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-13 13:16 [PATCH] destroy_workqueue() can livelock Oleg Nesterov
2007-07-13 17:03 ` Michal Schmidt [this message]
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=4697B056.9080508@redhat.com \
--to=mschmidt@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=stable@kernel.org \
--cc=vatsa@in.ibm.com \
/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