From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: Fix possible unexpectedly worker wakeup before started
Date: Wed, 19 Feb 2014 19:11:42 -0500 [thread overview]
Message-ID: <20140220001142.GV10134@htj.dyndns.org> (raw)
In-Reply-To: <1392781678-31952-1-git-send-email-laijs@cn.fujitsu.com>
Hello, Lai.
On Wed, Feb 19, 2014 at 11:47:58AM +0800, Lai Jiangshan wrote:
> If a worker is wokenup unexpectedly, it will start to work incorretly.
> Although it hardly happen, we should catch it and wait for being started
> if it does happen.
Can this actually happen? If so, how?
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> kernel/workqueue.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 82ef9f3..bee5fe1 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2284,6 +2284,12 @@ static int worker_thread(void *__worker)
> struct worker *worker = __worker;
> struct worker_pool *pool = worker->pool;
>
> + if (WARN_ON_ONCE(!(worker->flags & WORKER_STARTED))) {
And if this is something which can legitimately happen, why are we
triggering WARN on it?
> + /* The worker is wokenup unexpectedly before started */
> + mutex_lock(&pool->manager_mutex);
> + mutex_unlock(&pool->manager_mutex);
And what does these mutex cycling achieve (they need comment)?
Thanks.
--
tejun
next prev parent reply other threads:[~2014-02-20 0:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 3:47 Lai Jiangshan
2014-02-20 0:11 ` Tejun Heo [this message]
2014-02-20 1:50 ` Lai Jiangshan
2014-02-20 2:01 ` Lai Jiangshan
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=20140220001142.GV10134@htj.dyndns.org \
--to=tj@kernel.org \
--cc=laijs@cn.fujitsu.com \
--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®