* [PATCH] workque: fix opencoded cpumask_next_and_wrap() in wq_select_unbound_cpu()
@ 2025-06-05 0:21 Yury Norov
2025-06-09 18:26 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Yury Norov @ 2025-06-05 0:21 UTC (permalink / raw)
To: Tejun Heo, Lai Jiangshan, linux-kernel; +Cc: Yury Norov [NVIDIA]
From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
The dedicated helper is more verbose and effective comparing to
cpumask_first() followed by cpumask_next().
Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
---
kernel/workqueue.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 3bef0754cf73..3518ea5ec55f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2221,12 +2221,9 @@ static int wq_select_unbound_cpu(int cpu)
}
new_cpu = __this_cpu_read(wq_rr_cpu_last);
- new_cpu = cpumask_next_and(new_cpu, wq_unbound_cpumask, cpu_online_mask);
- if (unlikely(new_cpu >= nr_cpu_ids)) {
- new_cpu = cpumask_first_and(wq_unbound_cpumask, cpu_online_mask);
- if (unlikely(new_cpu >= nr_cpu_ids))
- return cpu;
- }
+ new_cpu = cpumask_next_and_wrap(new_cpu, wq_unbound_cpumask, cpu_online_mask);
+ if (unlikely(new_cpu >= nr_cpu_ids))
+ return cpu;
__this_cpu_write(wq_rr_cpu_last, new_cpu);
return new_cpu;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] workque: fix opencoded cpumask_next_and_wrap() in wq_select_unbound_cpu()
2025-06-05 0:21 [PATCH] workque: fix opencoded cpumask_next_and_wrap() in wq_select_unbound_cpu() Yury Norov
@ 2025-06-09 18:26 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2025-06-09 18:26 UTC (permalink / raw)
To: Yury Norov; +Cc: Lai Jiangshan, linux-kernel
On Wed, Jun 04, 2025 at 08:21:37PM -0400, Yury Norov wrote:
> From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
>
> The dedicated helper is more verbose and effective comparing to
> cpumask_first() followed by cpumask_next().
>
> Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
Applied to wq/for-6.17 w/ subsystem name fixed.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-09 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-05 0:21 [PATCH] workque: fix opencoded cpumask_next_and_wrap() in wq_select_unbound_cpu() Yury Norov
2025-06-09 18:26 ` 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®