kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND

At the time they are created unbound workqueues rescuers currently use
cpu_possible_mask as their affinity, but this can be too wide in case a
workqueue unbound mask has been set as a subset of cpu_possible_mask.

Make new rescuers use their associated workqueue unbound cpumask from
the start.

Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Juri Lelli 2024-01-16 17:19:27 +01:00 committed by Tejun Heo
parent ab5e5b99a9
commit 85f0ab43f9

View File

@ -4652,7 +4652,10 @@ static int init_rescuer(struct workqueue_struct *wq)
}
wq->rescuer = rescuer;
kthread_bind_mask(rescuer->task, cpu_possible_mask);
if (wq->flags & WQ_UNBOUND)
kthread_bind_mask(rescuer->task, wq->unbound_attrs->cpumask);
else
kthread_bind_mask(rescuer->task, cpu_possible_mask);
wake_up_process(rescuer->task);
return 0;