2023-05-10 07:42:44

by Anna-Maria Behnsen

[permalink] [raw]
Subject: [PATCH v6 08/21] workqueue: Use global variant for add_timer()

The implementation of the NOHZ pull at expiry model will change the timer
bases per CPU. Timers, that have to expire on a specific CPU, require the
TIMER_PINNED flag. If the CPU doesn't matter, the TIMER_PINNED flag must be
dropped. This is required for call sites which use the timer alternately as
pinned and not pinned timer like workqueues do.

Therefore use add_timer_global() to make sure TIMER_PINNED flag is dropped.

Signed-off-by: Anna-Maria Behnsen <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Lai Jiangshan <[email protected]>
---
v6:
- New patch: As v6 provides unconditially setting TIMER_PINNED flag in
add_timer_on() workqueue requires new add_timer_global() variant.
---
kernel/workqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 4666a1a92a31..5c529f19e709 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1682,7 +1682,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
if (unlikely(cpu != WORK_CPU_UNBOUND))
add_timer_on(timer, cpu);
else
- add_timer(timer);
+ add_timer_global(timer);
}

/**
--
2.30.2



2023-05-10 20:01:16

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH v6 08/21] workqueue: Use global variant for add_timer()

On Wed, May 10, 2023 at 09:28:04AM +0200, Anna-Maria Behnsen wrote:
> The implementation of the NOHZ pull at expiry model will change the timer
> bases per CPU. Timers, that have to expire on a specific CPU, require the
> TIMER_PINNED flag. If the CPU doesn't matter, the TIMER_PINNED flag must be
> dropped. This is required for call sites which use the timer alternately as
> pinned and not pinned timer like workqueues do.
>
> Therefore use add_timer_global() to make sure TIMER_PINNED flag is dropped.
>
> Signed-off-by: Anna-Maria Behnsen <[email protected]>
> Cc: Tejun Heo <[email protected]>
> Cc: Lai Jiangshan <[email protected]>

Acked-by: Tejun Heo <[email protected]>

Please feel free to route the patch as you see fit.

Thanks.

--
tejun

2023-06-05 22:34:12

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [PATCH v6 08/21] workqueue: Use global variant for add_timer()

Le Wed, May 10, 2023 at 09:28:04AM +0200, Anna-Maria Behnsen a ?crit :
> The implementation of the NOHZ pull at expiry model will change the timer
> bases per CPU. Timers, that have to expire on a specific CPU, require the
> TIMER_PINNED flag. If the CPU doesn't matter, the TIMER_PINNED flag must be
> dropped. This is required for call sites which use the timer alternately as
> pinned and not pinned timer like workqueues do.
>
> Therefore use add_timer_global() to make sure TIMER_PINNED flag is dropped.
>
> Signed-off-by: Anna-Maria Behnsen <[email protected]>
> Cc: Tejun Heo <[email protected]>
> Cc: Lai Jiangshan <[email protected]>

Reviewed-by: Frederic Weisbecker <[email protected]>