From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Tejun Heo <tj@kernel.org>, linux-kernel@vger.kernel.org
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH 08/11 V5] workqueue: unbind newly created worker
Date: Wed, 5 Sep 2012 18:37:45 +0800 [thread overview]
Message-ID: <1346841475-4422-9-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1346841475-4422-1-git-send-email-laijs@cn.fujitsu.com>
unbind newly created worker when manager is unbound.
It just prepares, this code is useless until
"we unbind/rebind without manager_mutex"
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index e9fc065..223d128 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -74,6 +74,8 @@ enum {
WORKER_NOT_RUNNING = WORKER_PREP | WORKER_UNBOUND |
WORKER_CPU_INTENSIVE,
+ WORKER_COPY_FLAGS = WORKER_UNBOUND,
+
NR_WORKER_POOLS = 2, /* # worker pools per gcwq */
BUSY_WORKER_HASH_ORDER = 6, /* 64 pointers */
@@ -1820,6 +1822,25 @@ static void start_worker(struct worker *worker)
}
/**
+ * manager_start_worker - start a newly created worker by manager
+ * @worker: worker to start
+ * @manager: the manager
+ *
+ * Make the gcwq aware of @worker and start it.
+ * Fix the newly created worker's binding.
+ *
+ * CONTEXT:
+ * spin_lock_irq(gcwq->lock).
+ */
+static void manager_start_worker(struct worker *worker, struct worker *manager)
+{
+ start_worker(worker);
+
+ /* copy the flags. also unbind the worker if the manager is unbound */
+ worker->flags |= manager->flags & WORKER_COPY_FLAGS;
+}
+
+/**
* destroy_worker - destroy a workqueue worker
* @worker: worker to be destroyed
*
@@ -1976,7 +1997,7 @@ restart:
if (worker) {
del_timer_sync(&pool->mayday_timer);
spin_lock_irq(&gcwq->lock);
- start_worker(worker);
+ manager_start_worker(worker, pool->manager);
BUG_ON(need_to_create_worker(pool));
return true;
}
--
1.7.4.4
next prev parent reply other threads:[~2012-09-05 10:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 10:37 [PATCH 00/11 V5] workqueue: reimplement unbind/rebind Lai Jiangshan
2012-09-05 10:37 ` [PATCH 01/11 V5] workqueue: ensure the wq_worker_sleeping() see the right flags Lai Jiangshan
2012-09-05 10:37 ` [PATCH 02/11 V5] workqueue: async idle rebinding Lai Jiangshan
2012-09-05 18:06 ` Tejun Heo
2012-09-06 1:28 ` Lai Jiangshan
2012-09-05 10:37 ` [PATCH 03/11 V5] workqueue: new day don't need WORKER_REBIND for busy rebinding Lai Jiangshan
2012-09-05 18:31 ` Tejun Heo
2012-09-06 2:10 ` Lai Jiangshan
2012-09-05 10:37 ` [PATCH 04/11 V5] workqueue: remove WORKER_REBIND Lai Jiangshan
2012-09-05 10:37 ` [PATCH 05/11 V5] workqueue: Add @bind arguement back without change any thing Lai Jiangshan
2012-09-05 19:49 ` Tejun Heo
2012-09-06 1:04 ` Lai Jiangshan
2012-09-06 16:51 ` Tejun Heo
2012-09-07 2:11 ` Lai Jiangshan
2012-09-07 19:37 ` Tejun Heo
2012-09-05 10:37 ` [PATCH 06/11 V5] workqueue: unbind manager Lai Jiangshan
2012-09-05 10:37 ` [PATCH 07/11 V5] workqueue: rebind manager Lai Jiangshan
2012-09-05 10:37 ` Lai Jiangshan [this message]
2012-09-05 10:37 ` [PATCH 09/11 V5] workqueue: rebind newly created worker Lai Jiangshan
2012-09-05 16:19 ` Lai Jiangshan
2012-09-05 10:37 ` [PATCH 10/11 V5] workqueue: unbind/rebind without manager_mutex Lai Jiangshan
2012-09-05 20:04 ` Tejun Heo
2012-09-06 10:44 ` Lai Jiangshan
2012-09-06 17:00 ` Tejun Heo
2012-09-05 10:37 ` [PATCH 11/11 V5] workqueue: remove manager_mutex 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=1346841475-4422-9-git-send-email-laijs@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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).