linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lai Jiangshan <jiangshanlai@gmail.com>
To: linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <laijs@linux.alibaba.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Subject: [PATCH 6/7] workqueue: Remove the cacheline_aligned for nr_running
Date: Tue,  7 Dec 2021 15:35:42 +0800	[thread overview]
Message-ID: <20211207073543.61092-7-jiangshanlai@gmail.com> (raw)
In-Reply-To: <20211207073543.61092-1-jiangshanlai@gmail.com>

From: Lai Jiangshan <laijs@linux.alibaba.com>

nr_running is never modified remotely after the schedule callback in
wakeup path is removed.

Rather nr_running is often accessed with other fields in the pool
together, so the cacheline_aligned for nr_running isn't needed.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
---
 kernel/workqueue.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 256f552e9513..33f1106b4f99 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -154,6 +154,9 @@ struct worker_pool {
 
 	unsigned long		watchdog_ts;	/* L: watchdog timestamp */
 
+	/* The current concurrency level. */
+	atomic_t		nr_running;
+
 	struct list_head	worklist;	/* L: list of pending works */
 
 	int			nr_workers;	/* L: total number of workers */
@@ -177,19 +180,12 @@ struct worker_pool {
 	struct hlist_node	hash_node;	/* PL: unbound_pool_hash node */
 	int			refcnt;		/* PL: refcnt for unbound pools */
 
-	/*
-	 * The current concurrency level.  As it's likely to be accessed
-	 * from other CPUs during try_to_wake_up(), put it in a separate
-	 * cacheline.
-	 */
-	atomic_t		nr_running ____cacheline_aligned_in_smp;
-
 	/*
 	 * Destruction of pool is RCU protected to allow dereferences
 	 * from get_work_pool().
 	 */
 	struct rcu_head		rcu;
-} ____cacheline_aligned_in_smp;
+};
 
 /*
  * The per-pool workqueue.  While queued, the lower WORK_STRUCT_FLAG_BITS
-- 
2.19.1.6.gb485710b


  parent reply	other threads:[~2021-12-07  7:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07  7:35 [PATCH 0/7] workqueue: cleanups for schedule callbacks Lai Jiangshan
2021-12-07  7:35 ` [PATCH 1/7] workqueue: Remove the outdated comment before wq_worker_sleeping() Lai Jiangshan
2021-12-07  7:35 ` [PATCH 2/7] workqueue: Remove the advanced kicking of the idle workers in rebind_workers() Lai Jiangshan
2021-12-07  7:35 ` [PATCH 3/7] workqueue: Remove outdated comment about exceptional workers in unbind_workers() Lai Jiangshan
2021-12-09 22:16   ` Tejun Heo
2021-12-07  7:35 ` [PATCH 4/7] workqueue: Remove schedule() " Lai Jiangshan
2021-12-07  7:35 ` [PATCH 5/7] workqueue: Move the code of waking a worker up " Lai Jiangshan
2021-12-07  7:35 ` Lai Jiangshan [this message]
2021-12-09 22:07   ` [PATCH 6/7] workqueue: Remove the cacheline_aligned for nr_running Tejun Heo
2021-12-09 23:31     ` Lai Jiangshan
2021-12-09 22:27   ` Tejun Heo
2021-12-07  7:35 ` [RFC PATCH 7/7] workqueue: Replace pool lock with preemption disabling in wq_worker_sleeping() Lai Jiangshan
2021-12-09 22:14   ` 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=20211207073543.61092-7-jiangshanlai@gmail.com \
    --to=jiangshanlai@gmail.com \
    --cc=laijs@linux.alibaba.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).