* [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated
@ 2024-05-13 14:01 Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 1/2] " Wenchao Hao
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Wenchao Hao @ 2024-05-13 14:01 UTC (permalink / raw)
To: Tejun Heo, Lai Jiangshan, Aaron Tomlin, linux-kernel
Cc: Wenchao Hao, Wenchao Hao
Task comm of task is limitted to 16, prefix "kworker/R-" is added for
rescuer worker's task, which cause most task name is truncated as
following:
root 81 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xprti]
root 82 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-cfg80]
root 85 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-nfsio]
root 86 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfsal]
root 87 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfs_m]
root 88 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-acpi_]
root 93 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-iscsi]
root 95 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
root 97 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
root 99 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
I want to fix this issue by split rescuer name to 2 part like other
kworker, the normal part is "kworker/R" which is set to task_struct's comm,
another part is wq->name which is added to kworker's desc. These 2 parts
would be merged in wq_worker_comm().
The first patch fix the rescuer task's name truncated;
The second patch fix workqueue_struct's name truncated.
V2:
Add another patch to increased worker desc's length to 32 to fix compile
warning reported:
https://lore.kernel.org/oe-kbuild-all/202405131400.sEYZHYk2-lkp@intel.com/
Wenchao Hao (2):
workqueue: Fix rescuer task's name truncated
workqueue: Increase worker desc's length to 32
include/linux/workqueue.h | 2 +-
kernel/workqueue.c | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
--
2.32.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] workqueue: Fix rescuer task's name truncated
2024-05-13 14:01 [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
@ 2024-05-13 14:01 ` Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 2/2] workqueue: Increase worker desc's length to 32 Wenchao Hao
2024-05-23 1:36 ` [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
2 siblings, 0 replies; 6+ messages in thread
From: Wenchao Hao @ 2024-05-13 14:01 UTC (permalink / raw)
To: Tejun Heo, Lai Jiangshan, Aaron Tomlin, linux-kernel
Cc: Wenchao Hao, Wenchao Hao
Task comm of task is limitted to 16, prefix "kworker/R-" is added for
rescuer worker's task, which cause most task name is truncated as
following:
root 81 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xprti]
root 82 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-cfg80]
root 85 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-nfsio]
root 86 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfsal]
root 87 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfs_m]
root 88 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-acpi_]
root 93 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-iscsi]
root 95 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
root 97 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
root 99 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
Fix this issue by split rescuer name to 2 part like other kworker,
the normal part is "kworker/R" which is set to task_struct's comm,
another part is wq->name which is added to kworker's desc. These 2 parts
would be merged in wq_worker_comm().
Fixes: b6a46f7263bd ("workqueue: Rename rescuer kworker")
Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
---
kernel/workqueue.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d2dbe099286b..07c077a53f93 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5443,7 +5443,7 @@ static int init_rescuer(struct workqueue_struct *wq)
}
rescuer->rescue_wq = wq;
- rescuer->task = kthread_create(rescuer_thread, rescuer, "kworker/R-%s", wq->name);
+ rescuer->task = kthread_create(rescuer_thread, rescuer, "kworker/R");
if (IS_ERR(rescuer->task)) {
ret = PTR_ERR(rescuer->task);
pr_err("workqueue: Failed to create a rescuer kthread for wq \"%s\": %pe",
@@ -5452,6 +5452,8 @@ static int init_rescuer(struct workqueue_struct *wq)
return ret;
}
+ snprintf(rescuer->desc, sizeof(rescuer->desc), "%s", wq->name);
+
wq->rescuer = rescuer;
if (wq->flags & WQ_UNBOUND)
kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
@@ -6302,6 +6304,8 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task)
worker->desc);
}
raw_spin_unlock_irq(&pool->lock);
+ } else if (worker->desc[0] != '\0') {
+ scnprintf(buf + off, size - off, "-%s", worker->desc);
}
}
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] workqueue: Increase worker desc's length to 32
2024-05-13 14:01 [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 1/2] " Wenchao Hao
@ 2024-05-13 14:01 ` Wenchao Hao
2024-05-23 1:36 ` [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
2 siblings, 0 replies; 6+ messages in thread
From: Wenchao Hao @ 2024-05-13 14:01 UTC (permalink / raw)
To: Tejun Heo, Lai Jiangshan, Aaron Tomlin, linux-kernel
Cc: Wenchao Hao, Wenchao Hao, kernel test robot
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, such as usage in process_one_work().
Fixes: 31c89007285d ("workqueue.c: Increase workqueue name length")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405131400.sEYZHYk2-lkp@intel.com/
Signed-off-by: Wenchao Hao <haowenchao2@huawei.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 158784dd189a..72031fa80414 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -92,7 +92,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.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated
2024-05-13 14:01 [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 1/2] " Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 2/2] workqueue: Increase worker desc's length to 32 Wenchao Hao
@ 2024-05-23 1:36 ` Wenchao Hao
2024-05-26 18:50 ` Tejun Heo
2 siblings, 1 reply; 6+ messages in thread
From: Wenchao Hao @ 2024-05-23 1:36 UTC (permalink / raw)
To: Wenchao Hao, Tejun Heo, Lai Jiangshan, Aaron Tomlin, linux-kernel
On 2024/5/13 22:01, Wenchao Hao wrote:
> Task comm of task is limitted to 16, prefix "kworker/R-" is added for
> rescuer worker's task, which cause most task name is truncated as
> following:
>
> root 81 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xprti]
> root 82 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-cfg80]
> root 85 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-nfsio]
> root 86 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfsal]
> root 87 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfs_m]
> root 88 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-acpi_]
> root 93 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-iscsi]
> root 95 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
> root 97 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
> root 99 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_]
>
> I want to fix this issue by split rescuer name to 2 part like other
> kworker, the normal part is "kworker/R" which is set to task_struct's comm,
> another part is wq->name which is added to kworker's desc. These 2 parts
> would be merged in wq_worker_comm().
>
> The first patch fix the rescuer task's name truncated;
> The second patch fix workqueue_struct's name truncated.
>
Friendly ping...
> V2:
> Add another patch to increased worker desc's length to 32 to fix compile
> warning reported:
> https://lore.kernel.org/oe-kbuild-all/202405131400.sEYZHYk2-lkp@intel.com/
>
> Wenchao Hao (2):
> workqueue: Fix rescuer task's name truncated
> workqueue: Increase worker desc's length to 32
>
> include/linux/workqueue.h | 2 +-
> kernel/workqueue.c | 6 +++++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated
2024-05-23 1:36 ` [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
@ 2024-05-26 18:50 ` Tejun Heo
2024-05-27 1:59 ` Wenchao Hao
0 siblings, 1 reply; 6+ messages in thread
From: Tejun Heo @ 2024-05-26 18:50 UTC (permalink / raw)
To: Wenchao Hao; +Cc: Wenchao Hao, Lai Jiangshan, Aaron Tomlin, linux-kernel
Hello,
On Thu, May 23, 2024 at 09:36:57AM +0800, Wenchao Hao wrote:
> > The first patch fix the rescuer task's name truncated;
> > The second patch fix workqueue_struct's name truncated.
I missed these and the issue got reported separately and a different fix has
been applied:
https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git/commit/?h=for-6.10-fixes&id=2a1b02bcba78f8498ab00d6142e1238d85b01591
My apologies for missing your patches. Can you please see whether the above
patch addresses the issues you saw.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated
2024-05-26 18:50 ` Tejun Heo
@ 2024-05-27 1:59 ` Wenchao Hao
0 siblings, 0 replies; 6+ messages in thread
From: Wenchao Hao @ 2024-05-27 1:59 UTC (permalink / raw)
To: Tejun Heo; +Cc: Wenchao Hao, Lai Jiangshan, Aaron Tomlin, linux-kernel
On 2024/5/27 2:50, Tejun Heo wrote:
> Hello,
>
> On Thu, May 23, 2024 at 09:36:57AM +0800, Wenchao Hao wrote:
>>> The first patch fix the rescuer task's name truncated;
>>> The second patch fix workqueue_struct's name truncated.
>
> I missed these and the issue got reported separately and a different fix has
> been applied:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git/commit/?h=for-6.10-fixes&id=2a1b02bcba78f8498ab00d6142e1238d85b01591
>
I applied these changes and the issue has been fixed.
> My apologies for missing your patches. Can you please see whether the above
> patch addresses the issues you saw.
> > Thanks.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-27 1:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-13 14:01 [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 1/2] " Wenchao Hao
2024-05-13 14:01 ` [PATCH v2 2/2] workqueue: Increase worker desc's length to 32 Wenchao Hao
2024-05-23 1:36 ` [PATCH v2 0/2] workqueue: Fix rescuer task's name truncated Wenchao Hao
2024-05-26 18:50 ` Tejun Heo
2024-05-27 1:59 ` Wenchao Hao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox