* [PATCH] workqueue: Initialize wq_isolated_cpumask in workqueue_init_early()
@ 2025-06-17 4:42 Chuyi Zhou
2025-06-17 5:00 ` Waiman Long
2025-06-17 18:59 ` Tejun Heo
0 siblings, 2 replies; 3+ messages in thread
From: Chuyi Zhou @ 2025-06-17 4:42 UTC (permalink / raw)
To: longman, tj, jiangshanlai; +Cc: linux-kernel, Chuyi Zhou
Now when isolcpus is enabled via the cmdline, wq_isolated_cpumask does
not include these isolated CPUs, even wq_unbound_cpumask has already
excluded them. It is only when we successfully configure an isolate cpuset
partition that wq_isolated_cpumask gets overwritten by
workqueue_unbound_exclude_cpumask(), including both the cmdline-specified
isolated CPUs and the isolated CPUs within the cpuset partitions.
Fix this issue by initializing wq_isolated_cpumask properly in
workqueue_init_early().
Fixes: fe28f631fa94 ("workqueue: Add workqueue_unbound_exclude_cpumask() to exclude CPUs from wq_unbound_cpumask")
Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
---
kernel/workqueue.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 97f37b5bae669..9f91480758288 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -7767,7 +7767,8 @@ void __init workqueue_init_early(void)
restrict_unbound_cpumask("workqueue.unbound_cpus", &wq_cmdline_cpumask);
cpumask_copy(wq_requested_unbound_cpumask, wq_unbound_cpumask);
-
+ cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask,
+ housekeeping_cpumask(HK_TYPE_DOMAIN));
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
unbound_wq_update_pwq_attrs_buf = alloc_workqueue_attrs();
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] workqueue: Initialize wq_isolated_cpumask in workqueue_init_early()
2025-06-17 4:42 [PATCH] workqueue: Initialize wq_isolated_cpumask in workqueue_init_early() Chuyi Zhou
@ 2025-06-17 5:00 ` Waiman Long
2025-06-17 18:59 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Waiman Long @ 2025-06-17 5:00 UTC (permalink / raw)
To: Chuyi Zhou, tj, jiangshanlai; +Cc: linux-kernel
On 6/17/25 12:42 AM, Chuyi Zhou wrote:
> Now when isolcpus is enabled via the cmdline, wq_isolated_cpumask does
> not include these isolated CPUs, even wq_unbound_cpumask has already
> excluded them. It is only when we successfully configure an isolate cpuset
> partition that wq_isolated_cpumask gets overwritten by
> workqueue_unbound_exclude_cpumask(), including both the cmdline-specified
> isolated CPUs and the isolated CPUs within the cpuset partitions.
>
> Fix this issue by initializing wq_isolated_cpumask properly in
> workqueue_init_early().
>
> Fixes: fe28f631fa94 ("workqueue: Add workqueue_unbound_exclude_cpumask() to exclude CPUs from wq_unbound_cpumask")
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
> ---
> kernel/workqueue.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 97f37b5bae669..9f91480758288 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -7767,7 +7767,8 @@ void __init workqueue_init_early(void)
> restrict_unbound_cpumask("workqueue.unbound_cpus", &wq_cmdline_cpumask);
>
> cpumask_copy(wq_requested_unbound_cpumask, wq_unbound_cpumask);
> -
> + cpumask_andnot(wq_isolated_cpumask, cpu_possible_mask,
> + housekeeping_cpumask(HK_TYPE_DOMAIN));
> pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
>
> unbound_wq_update_pwq_attrs_buf = alloc_workqueue_attrs();
Right, the wq_isolated_cpumask isn't initialized properly. Thank for
fixing that.
Reviewed-by: Waiman Long <longman@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] workqueue: Initialize wq_isolated_cpumask in workqueue_init_early()
2025-06-17 4:42 [PATCH] workqueue: Initialize wq_isolated_cpumask in workqueue_init_early() Chuyi Zhou
2025-06-17 5:00 ` Waiman Long
@ 2025-06-17 18:59 ` Tejun Heo
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2025-06-17 18:59 UTC (permalink / raw)
To: Chuyi Zhou; +Cc: longman, jiangshanlai, linux-kernel
On Tue, Jun 17, 2025 at 12:42:16PM +0800, Chuyi Zhou wrote:
> Now when isolcpus is enabled via the cmdline, wq_isolated_cpumask does
> not include these isolated CPUs, even wq_unbound_cpumask has already
> excluded them. It is only when we successfully configure an isolate cpuset
> partition that wq_isolated_cpumask gets overwritten by
> workqueue_unbound_exclude_cpumask(), including both the cmdline-specified
> isolated CPUs and the isolated CPUs within the cpuset partitions.
>
> Fix this issue by initializing wq_isolated_cpumask properly in
> workqueue_init_early().
>
> Fixes: fe28f631fa94 ("workqueue: Add workqueue_unbound_exclude_cpumask() to exclude CPUs from wq_unbound_cpumask")
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
Applied to wq/for-6.16-fixes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-17 18:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 4:42 [PATCH] workqueue: Initialize wq_isolated_cpumask in workqueue_init_early() Chuyi Zhou
2025-06-17 5:00 ` Waiman Long
2025-06-17 18:59 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).