From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH wq/for-3.6-fixes 3/3] workqueue: fix possible idle worker depletion during CPU_ONLINE
Date: Fri, 7 Sep 2012 13:22:49 -0700 [thread overview]
Message-ID: <20120907202249.GH9426@google.com> (raw)
In-Reply-To: <20120907192939.GF9426@google.com>
Hello again, Lai.
On Fri, Sep 07, 2012 at 12:29:39PM -0700, Tejun Heo wrote:
> > Since we introduce manage_mutex(), any palace should be allowed to grab it
> > when its context allows. So it is not hotplug code's responsibility of this bug.
> >
> > manage_workers() just use mutex_trylock() to grab the lock, it does not make
> > hard to do it jobs when need, and it does not try to find out the reason of fail.
> > so I think it is manage_workers()'s responsibility to handle this bug.
> > a manage_workers_slowpath() is enough to fix the bug.
>
> It doesn't really matter how the synchronization between regular
> manager and hotplug path is done. The point is that hotplug path, as
> much as possible, should be responsible for any incurred complexities,
> so I'd really like to stay away from adding a completely different
> path manager can be invoked in the usual path if at all possible.
> Let's try to solve this from the hotplug side.
So, how about something like the following?
* Make manage_workers() called outside gcwq->lock (or drop gcwq->lock
after checking MANAGING). worker_thread() can jump back to woke_up:
instead.
* Distinguish synchronization among workers and against hotplug. Was
this what you tried with non_manager_mutex? Anyways, revive
WORKER_MANAGING to synchronize among workers. If the worker won
MANAGING, drop gcwq->lock and mutex_lock() gcwq->hotplug_mutex and
then do other stuff.
This should prevent any idle worker passing through manage_workers()
while hotplug is in progress. Do you think it would work?
Thanks.
--
tejun
next prev parent reply other threads:[~2012-09-07 20:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 20:06 [PATCH wq/for-3.6-fixes 1/3] workqueue: break out gcwq->lock locking from gcwq_claim/release_management_and_[un]lock() Tejun Heo
2012-09-06 20:07 ` [PATCH wq/for-3.6-fixes 2/3] workqueue: rename rebind_workers() to gcwq_associate() and let it handle locking and DISASSOCIATED clearing Tejun Heo
2012-09-06 20:08 ` [PATCH wq/for-3.6-fixes 3/3] workqueue: fix possible idle worker depletion during CPU_ONLINE Tejun Heo
2012-09-07 1:53 ` Lai Jiangshan
2012-09-07 19:25 ` Tejun Heo
2012-09-07 3:10 ` Lai Jiangshan
2012-09-07 19:29 ` Tejun Heo
2012-09-07 20:22 ` Tejun Heo [this message]
2012-09-07 20:34 ` Tejun Heo
2012-09-07 23:05 ` Tejun Heo
2012-09-07 23:07 ` Tejun Heo
2012-09-07 23:41 ` Tejun Heo
2012-09-08 17:18 ` Lai Jiangshan
2012-09-08 17:29 ` Tejun Heo
2012-09-08 17:32 ` Tejun Heo
2012-09-08 17:40 ` Lai Jiangshan
2012-09-08 17:41 ` Tejun Heo
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=20120907202249.GH9426@google.com \
--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