linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 04/10 V4] workqueue: add manage_workers_slowpath()
Date: Tue, 4 Sep 2012 18:12:35 -0700	[thread overview]
Message-ID: <20120905011235.GC2836@dhcp-172-17-108-109.mtv.corp.google.com> (raw)
In-Reply-To: <1346516916-1991-5-git-send-email-laijs@cn.fujitsu.com>

Hello, Lai.

On Sun, Sep 02, 2012 at 12:28:22AM +0800, Lai Jiangshan wrote:
> If hotplug code grabbed the manager_mutex and worker_thread try to create
> a worker, the manage_worker() will return false and worker_thread go to
> process work items. Now, on the CPU, all workers are processing work items,
> no idle_worker left/ready for managing. It breaks the concept of workqueue
> and it is bug.
> 
> So when manage_worker() failed to grab the manager_mutex, it should
> try to enter normal process contex and then compete on the manager_mutex
> instead of return false.
> 
> To safely do this, we add manage_workers_slowpath() and the worker
> go to process work items mode to do the managing jobs. thus
> managing jobs are processed via work item and can free to compete
> on manager_mutex.

Ummm.... this seems overly complicated.  How about scheduling rebind
work to a worker and forcing it to break out of the work processing
loop?  I think it can be done fairly easily using POOL_MANAGE_WORKERS
- set it from the rebind function, break out of work processing loop
if it's set, replace need_to_manage_workers() with POOL_MANAGE_WORKERS
test (the function really isn't necessary) and always jump back to
recheck afterwards.  It might need a bit more mangling here and there
but that should be the essence of it.  I'll give a stab at it later
today.

Thanks.

-- 
tejun

  reply	other threads:[~2012-09-05  1:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-01 16:28 [PATCH 00/10 V4] workqueue: fix and cleanup hotplug/rebind_workers() Lai Jiangshan
2012-09-01 16:28 ` [PATCH 01/10 V4] workqueue: ensure the wq_worker_sleeping() see the right flags Lai Jiangshan
2012-09-04 23:39   ` [PATCH] workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic Tejun Heo
2012-09-04 23:58     ` [PATCH -stable] " Tejun Heo
2012-09-16 15:49       ` Ben Hutchings
2012-09-05  1:05     ` [PATCH] " Lai Jiangshan
2012-09-05  1:17       ` Tejun Heo
2012-09-01 16:28 ` [PATCH 02/10 V4] workqueue: fix deadlock in rebind_workers() Lai Jiangshan
2012-09-05  0:54   ` Tejun Heo
2012-09-05  1:28     ` Lai Jiangshan
2012-09-05  1:33       ` Tejun Heo
2012-09-01 16:28 ` [PATCH 03/10 V4] workqueue: add POOL_MANAGING_WORKERS Lai Jiangshan
2012-09-01 16:28 ` [PATCH 04/10 V4] workqueue: add manage_workers_slowpath() Lai Jiangshan
2012-09-05  1:12   ` Tejun Heo [this message]
2012-09-06  1:55     ` Lai Jiangshan
2012-09-01 16:28 ` [PATCH 05/10 V4] workqueue: move rebind_hold to idle_rebind Lai Jiangshan
2012-09-01 16:28 ` [PATCH 06/10 V4] workqueue: simple clear WORKER_REBIND Lai Jiangshan
2012-09-01 16:28 ` [PATCH 07/10 V4] workqueue: move idle_rebind pointer to gcwq Lai Jiangshan
2012-09-01 16:28 ` [PATCH 08/10 V4] workqueue: explicit way to wait for idles workers to finish Lai Jiangshan
2012-09-01 16:28 ` [PATCH 09/10] workqueue: single pass rebind_workers Lai Jiangshan
2012-09-01 16:28 ` [PATCH 10/10 V4] workqueue: merge the role of rebind_hold to idle_done Lai Jiangshan
2012-09-05  1:15   ` Tejun Heo
2012-09-05  1:48     ` 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=20120905011235.GC2836@dhcp-172-17-108-109.mtv.corp.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;
as well as URLs for NNTP newsgroup(s).