From: Tejun Heo <tj@kernel.org>
To: jiangshanlai@gmail.com
Cc: torvalds@linux-foundation.org, peterz@infradead.org,
linux-kernel@vger.kernel.org, kernel-team@meta.com,
Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/6] workqueue: Re-order struct worker fields
Date: Tue, 9 May 2023 17:07:48 -1000 [thread overview]
Message-ID: <20230510030752.542340-3-tj@kernel.org> (raw)
In-Reply-To: <20230510030752.542340-1-tj@kernel.org>
struct worker was laid out with the intent that all fields that are modified
for each work item execution are in the first cacheline. However, this
hasn't been true for a while with the addition of ->last_func. Let's just
collect hot fields together at the top.
Move ->sleeping in the hole after ->current_color and move ->lst_func right
below. While at it, drop the cacheline comment which isn't useful anymore.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
---
kernel/workqueue_internal.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
index c34b876af16d..a20b4d052a45 100644
--- a/kernel/workqueue_internal.h
+++ b/kernel/workqueue_internal.h
@@ -32,9 +32,12 @@ struct worker {
work_func_t current_func; /* L: current_work's fn */
struct pool_workqueue *current_pwq; /* L: current_work's pwq */
unsigned int current_color; /* L: current_work's color */
- struct list_head scheduled; /* L: scheduled works */
+ int sleeping; /* None */
+
+ /* used by the scheduler to determine a worker's last known identity */
+ work_func_t last_func; /* L: last work's fn */
- /* 64 bytes boundary on 64bit, 32 on 32bit */
+ struct list_head scheduled; /* L: scheduled works */
struct task_struct *task; /* I: worker task */
struct worker_pool *pool; /* A: the associated pool */
@@ -45,7 +48,6 @@ struct worker {
unsigned long last_active; /* L: last active timestamp */
unsigned int flags; /* X: flags */
int id; /* I: worker id */
- int sleeping; /* None */
/*
* Opaque string set with work_set_desc(). Printed out with task
@@ -55,9 +57,6 @@ struct worker {
/* used only by rescuers to point to the target workqueue */
struct workqueue_struct *rescue_wq; /* I: the workqueue to rescue */
-
- /* used by the scheduler to determine a worker's last known identity */
- work_func_t last_func;
};
/**
--
2.40.1
next prev parent reply other threads:[~2023-05-10 3:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-10 3:07 [PATCHSET v2 wq/for-6.5] workqueue: Implement automatic CPU intensive detection and add monitoring Tejun Heo
2023-05-10 3:07 ` [PATCH 1/6] workqueue, sched: Notify workqueue of scheduling of RUNNING and preempted tasks Tejun Heo
2023-05-10 3:07 ` Tejun Heo [this message]
2023-05-10 3:07 ` [PATCH 3/6] workqueue: Move worker_set/clr_flags() upwards Tejun Heo
2023-05-10 14:30 ` Linus Torvalds
2023-05-10 18:18 ` Tejun Heo
2023-05-10 3:07 ` [PATCH 4/6] workqueue: Automatically mark CPU-hogging work items CPU_INTENSIVE Tejun Heo
2023-05-10 15:09 ` Peter Zijlstra
2023-05-10 16:08 ` Tejun Heo
2023-05-10 3:07 ` [PATCH 5/6] workqueue: Report work funcs that trigger automatic CPU_INTENSIVE mechanism Tejun Heo
2023-05-10 3:07 ` [PATCH 6/6] workqueue: Add pwq->stats[] and a monitoring script 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=20230510030752.542340-3-tj@kernel.org \
--to=tj@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.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