* [PATCH v2] workqueue: Do not set CPU_INTENSIVE worker flags with wq_cpu_intensive_thresh_us=0
@ 2023-05-25 4:00 Zqiang
2023-05-25 20:48 ` Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Zqiang @ 2023-05-25 4:00 UTC (permalink / raw)
To: tj, jiangshanlai, qiang.zhang1211; +Cc: linux-kernel
If the system start with workqueue.cpu_intensive_thresh_us=0, for running
per-cpu worker, the CPU_INTENSIVE flag will be set unconditionally in
wq_worker_tick(), this commit therefore disable set CPU_INTENSIVE and
directly return when workqueue.cpu_intensive_thresh_us=0.
Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
---
[ 17.359725] workqueue: process_srcu hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
[ 19.752679] workqueue: gc_worker hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
[ 19.796721] workqueue: gc_worker hogged CPU for >0us 8 times, consider switching to WQ_UNBOUND
[ 21.992637] workqueue: wait_rcu_exp_gp hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
[ 27.143632] workqueue: kfree_rcu_monitor hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
[ 27.143647] workqueue: kfree_rcu_monitor hogged CPU for >0us 8 times, consider switching to WQ_UNBOUND
[ 38.472708] workqueue: reg_todo hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
kernel/workqueue.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c4f4ca0bd2af..eaea5386859e 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1152,6 +1152,7 @@ void wq_worker_tick(struct task_struct *task)
* We probably want to make this prettier in the future.
*/
if ((worker->flags & WORKER_NOT_RUNNING) || READ_ONCE(worker->sleeping) ||
+ !wq_cpu_intensive_thresh_us ||
worker->task->se.sum_exec_runtime - worker->current_at <
wq_cpu_intensive_thresh_us * NSEC_PER_USEC)
return;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] workqueue: Do not set CPU_INTENSIVE worker flags with wq_cpu_intensive_thresh_us=0
2023-05-25 4:00 [PATCH v2] workqueue: Do not set CPU_INTENSIVE worker flags with wq_cpu_intensive_thresh_us=0 Zqiang
@ 2023-05-25 20:48 ` Tejun Heo
2023-05-26 2:20 ` Z qiang
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2023-05-25 20:48 UTC (permalink / raw)
To: Zqiang; +Cc: jiangshanlai, linux-kernel
Hello,
I rewrote the patch description and separated it out into a separate if
statement for readability. Applied to wq/for-6.5.
Thanks.
From 18c8ae813156a6855f026de80fffb91e1a28ab3d Mon Sep 17 00:00:00 2001
From: Zqiang <qiang.zhang1211@gmail.com>
Date: Thu, 25 May 2023 12:00:38 +0800
Subject: [PATCH] workqueue: Disable per-cpu CPU hog detection when
wq_cpu_intensive_thresh_us is 0
If workqueue.cpu_intensive_thresh_us is set to 0, the detection mechanism
for CPU-hogging per-cpu work item will keep triggering spuriously:
workqueue: process_srcu hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
workqueue: gc_worker hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
workqueue: gc_worker hogged CPU for >0us 8 times, consider switching to WQ_UNBOUND
workqueue: wait_rcu_exp_gp hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
workqueue: kfree_rcu_monitor hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
workqueue: kfree_rcu_monitor hogged CPU for >0us 8 times, consider switching to WQ_UNBOUND
workqueue: reg_todo hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
This commit therefore disables the CPU-hog detection mechanism when
workqueue.cpu_intensive_thresh_us is set to 0.
tj: Patch description updated and the condition check on
cpu_intensive_thresh_us separated into a separate if statement for
readability.
Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
Can you please use your full name as in "FIRST_NAME LAST_NAME <EMAIL>" when
signing-off patches in the future?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] workqueue: Do not set CPU_INTENSIVE worker flags with wq_cpu_intensive_thresh_us=0
2023-05-25 20:48 ` Tejun Heo
@ 2023-05-26 2:20 ` Z qiang
0 siblings, 0 replies; 3+ messages in thread
From: Z qiang @ 2023-05-26 2:20 UTC (permalink / raw)
To: Tejun Heo; +Cc: jiangshanlai, linux-kernel
>
> Hello,
>
> I rewrote the patch description and separated it out into a separate if
> statement for readability. Applied to wq/for-6.5.
>
> Thanks.
>
> From 18c8ae813156a6855f026de80fffb91e1a28ab3d Mon Sep 17 00:00:00 2001
> From: Zqiang <qiang.zhang1211@gmail.com>
> Date: Thu, 25 May 2023 12:00:38 +0800
> Subject: [PATCH] workqueue: Disable per-cpu CPU hog detection when
> wq_cpu_intensive_thresh_us is 0
>
> If workqueue.cpu_intensive_thresh_us is set to 0, the detection mechanism
> for CPU-hogging per-cpu work item will keep triggering spuriously:
>
> workqueue: process_srcu hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
> workqueue: gc_worker hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
> workqueue: gc_worker hogged CPU for >0us 8 times, consider switching to WQ_UNBOUND
> workqueue: wait_rcu_exp_gp hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
> workqueue: kfree_rcu_monitor hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
> workqueue: kfree_rcu_monitor hogged CPU for >0us 8 times, consider switching to WQ_UNBOUND
> workqueue: reg_todo hogged CPU for >0us 4 times, consider switching to WQ_UNBOUND
>
> This commit therefore disables the CPU-hog detection mechanism when
> workqueue.cpu_intensive_thresh_us is set to 0.
>
> tj: Patch description updated and the condition check on
> cpu_intensive_thresh_us separated into a separate if statement for
> readability.
>
> Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
>
> Can you please use your full name as in "FIRST_NAME LAST_NAME <EMAIL>" when
> signing-off patches in the future?
>
Because there are many people with the same name as me, so I use the
abbreviation of the name to distinguish,
but in the future I will use the full name :) .
Thanks
Zqiang
>
> Thanks.
>
> --
> tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-26 2:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 4:00 [PATCH v2] workqueue: Do not set CPU_INTENSIVE worker flags with wq_cpu_intensive_thresh_us=0 Zqiang
2023-05-25 20:48 ` Tejun Heo
2023-05-26 2:20 ` Z qiang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.