mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH 1/2] workqueue: clear POOL_DISASSOCIATED in rebind_workers()
Date: Tue, 3 Jun 2014 15:33:27 +0800	[thread overview]
Message-ID: <1401780809-12331-1-git-send-email-laijs@cn.fujitsu.com> (raw)

The commit a9ab775bcadf ("workqueue: directly restore CPU affinity of workers
from CPU_ONLINE") moved the pool->lock into rebind_workers() without also
moving "pool->flags &= ~POOL_DISASSOCIATED" into.

There is no wrong that "pool->flags &= ~POOL_DISASSOCIATED" is kept outside,
but there is no benefit either. We move it into rebind_workers() and
achieve these benefits:
  1) better readability, POOL_DISASSOCIATED is cleared in rebind_workers()
     as supposed.
  2) when POOL_DISASSOCIATED is cleared, we can ensure that the running
     workers of the pool are on the local CPU (pool->cpu).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/workqueue.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 61381a2..5ae491e 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4535,6 +4535,7 @@ static void rebind_workers(struct worker_pool *pool)
 						  pool->attrs->cpumask) < 0);
 
 	spin_lock_irq(&pool->lock);
+	pool->flags &= ~POOL_DISASSOCIATED;
 
 	for_each_pool_worker(worker, pool) {
 		unsigned int worker_flags = worker->flags;
@@ -4637,10 +4638,6 @@ static int workqueue_cpu_up_callback(struct notifier_block *nfb,
 			mutex_lock(&pool->attach_mutex);
 
 			if (pool->cpu == cpu) {
-				spin_lock_irq(&pool->lock);
-				pool->flags &= ~POOL_DISASSOCIATED;
-				spin_unlock_irq(&pool->lock);
-
 				rebind_workers(pool);
 			} else if (pool->cpu < 0) {
 				restore_unbound_workers_cpumask(pool, cpu);
-- 
1.7.4.4


             reply	other threads:[~2014-06-03  7:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03  7:33 Lai Jiangshan [this message]
2014-06-03  7:33 ` [PATCH 2/2] workqueue: stronger test in process_one_work() Lai Jiangshan
2014-06-19 19:44   ` Tejun Heo
2014-06-26 11:27     ` Lai Jiangshan
2014-06-30  2:32       ` Lai Jiangshan
2014-07-01 21: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=1401780809-12331-1-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

Powered by JetHome