From: Richard Clark <richard.xnu.clark@gmail.com>
To: tj@kernel.org
Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org,
Richard Clark <richard.xnu.clark@gmail.com>
Subject: [PATCH] workqueue: Remove the unbound release work from the per-cpu type
Date: Wed, 23 Nov 2022 17:50:58 +0800 [thread overview]
Message-ID: <20221123095058.669684-1-richard.xnu.clark@gmail.com> (raw)
Both the per-cpu and unbound workqueue will call init_pwq(...) currently,
the latter will init an unbound release work for the pwq which is unnecessary
for the per-cpu type workqueue.
This commit will remove this work item from the per-cpu workqueue by checking the
wq->flags in init_pwq(...), the work is still reserved for the unbound workqueue.
Signed-off-by: Richard Clark <richard.xnu.clark@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
---
kernel/workqueue.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7cd5f5e7e0a1..01bdfb74081e 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3807,7 +3807,8 @@ static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq,
INIT_LIST_HEAD(&pwq->inactive_works);
INIT_LIST_HEAD(&pwq->pwqs_node);
INIT_LIST_HEAD(&pwq->mayday_node);
- INIT_WORK(&pwq->unbound_release_work, pwq_unbound_release_workfn);
+ if (wq->flags & WQ_UNBOUND)
+ INIT_WORK(&pwq->unbound_release_work, pwq_unbound_release_workfn);
}
/* sync @pwq with the current state of its associated wq and link it */
--
2.37.2
next reply other threads:[~2022-11-23 9:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 9:50 Richard Clark [this message]
2022-11-25 3:01 ` richard clark
2022-11-28 3:24 ` Lai Jiangshan
2022-11-28 5:25 ` richard clark
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=20221123095058.669684-1-richard.xnu.clark@gmail.com \
--to=richard.xnu.clark@gmail.com \
--cc=jiangshanlai@gmail.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
all inboxes | Powered by JetHome®