mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] workqueue: Increase worker desc's length to 32
@ 2024-06-06  8:52 Wenchao Hao
  2024-06-06  8:52 ` [PATCH 2/2] workqueue: cleancode in alloc_and_link_pwqs() Wenchao Hao
  2024-06-07 16:24 ` [PATCH 1/2] workqueue: Increase worker desc's length to 32 Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Wenchao Hao @ 2024-06-06  8:52 UTC (permalink / raw)
  To: Tejun Heo, Lai Jiangshan, linux-kernel; +Cc: Wenchao Hao, Audra Mitchell

Commit 31c89007285d ("workqueue.c: Increase workqueue name length")
increased WQ_NAME_LEN from 24 to 32, but forget to increase
WORKER_DESC_LEN, which would cause truncation when setting kworker's
desc from workqueue_struct's name, process_one_work() for example.

Fixes: 31c89007285d ("workqueue.c: Increase workqueue name length")

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
CC: Audra Mitchell <audra@redhat.com>
---
 include/linux/workqueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index fb3993894536..d9968bfc8eac 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -95,7 +95,7 @@ enum wq_misc_consts {
 	WORK_BUSY_RUNNING	= 1 << 1,
 
 	/* maximum string length for set_worker_desc() */
-	WORKER_DESC_LEN		= 24,
+	WORKER_DESC_LEN		= 32,
 };
 
 /* Convenience constants - of type 'unsigned long', not 'enum'! */
-- 
2.38.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] workqueue: cleancode in alloc_and_link_pwqs()
  2024-06-06  8:52 [PATCH 1/2] workqueue: Increase worker desc's length to 32 Wenchao Hao
@ 2024-06-06  8:52 ` Wenchao Hao
  2024-06-07 16:26   ` Tejun Heo
  2024-06-07 16:24 ` [PATCH 1/2] workqueue: Increase worker desc's length to 32 Tejun Heo
  1 sibling, 1 reply; 4+ messages in thread
From: Wenchao Hao @ 2024-06-06  8:52 UTC (permalink / raw)
  To: Tejun Heo, Lai Jiangshan, linux-kernel; +Cc: Wenchao Hao

wq->flags would not change, so it's not necessary to check if WQ_BH
is set in loop for_each_possible_cpu(), move define and set of pools
out of loop to simpliy the code.

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
---
 kernel/workqueue.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 3fbaecfc88c2..078d56ddbe3a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5477,16 +5477,17 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
 		goto enomem;
 
 	if (!(wq->flags & WQ_UNBOUND)) {
+		struct worker_pool __percpu *pools;
+
+		if (wq->flags & WQ_BH)
+			pools = bh_worker_pools;
+		else
+			pools = cpu_worker_pools;
+
 		for_each_possible_cpu(cpu) {
 			struct pool_workqueue **pwq_p;
-			struct worker_pool __percpu *pools;
 			struct worker_pool *pool;
 
-			if (wq->flags & WQ_BH)
-				pools = bh_worker_pools;
-			else
-				pools = cpu_worker_pools;
-
 			pool = &(per_cpu_ptr(pools, cpu)[highpri]);
 			pwq_p = per_cpu_ptr(wq->cpu_pwq, cpu);
 
-- 
2.38.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] workqueue: Increase worker desc's length to 32
  2024-06-06  8:52 [PATCH 1/2] workqueue: Increase worker desc's length to 32 Wenchao Hao
  2024-06-06  8:52 ` [PATCH 2/2] workqueue: cleancode in alloc_and_link_pwqs() Wenchao Hao
@ 2024-06-07 16:24 ` Tejun Heo
  1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2024-06-07 16:24 UTC (permalink / raw)
  To: Wenchao Hao; +Cc: Lai Jiangshan, linux-kernel, Audra Mitchell

On Thu, Jun 06, 2024 at 04:52:15PM +0800, Wenchao Hao wrote:
> Commit 31c89007285d ("workqueue.c: Increase workqueue name length")
> increased WQ_NAME_LEN from 24 to 32, but forget to increase
> WORKER_DESC_LEN, which would cause truncation when setting kworker's
> desc from workqueue_struct's name, process_one_work() for example.
> 
> Fixes: 31c89007285d ("workqueue.c: Increase workqueue name length")
> 
> Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
> CC: Audra Mitchell <audra@redhat.com>

Applied to wq/for-6.10-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] workqueue: cleancode in alloc_and_link_pwqs()
  2024-06-06  8:52 ` [PATCH 2/2] workqueue: cleancode in alloc_and_link_pwqs() Wenchao Hao
@ 2024-06-07 16:26   ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2024-06-07 16:26 UTC (permalink / raw)
  To: Wenchao Hao; +Cc: Lai Jiangshan, linux-kernel

On Thu, Jun 06, 2024 at 04:52:16PM +0800, Wenchao Hao wrote:
> wq->flags would not change, so it's not necessary to check if WQ_BH
> is set in loop for_each_possible_cpu(), move define and set of pools
> out of loop to simpliy the code.
> 
> Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>

Applied to wq/for-6.11.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-07 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-06  8:52 [PATCH 1/2] workqueue: Increase worker desc's length to 32 Wenchao Hao
2024-06-06  8:52 ` [PATCH 2/2] workqueue: cleancode in alloc_and_link_pwqs() Wenchao Hao
2024-06-07 16:26   ` Tejun Heo
2024-06-07 16:24 ` [PATCH 1/2] workqueue: Increase worker desc's length to 32 Tejun Heo

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®