[RFC PATCH 2/4] kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND

Juri Lelli posted 4 patches 1 year, 11 months ago
[RFC PATCH 2/4] kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND
Posted by Juri Lelli 1 year, 11 months ago
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>
---
 kernel/workqueue.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 76e60faed8923..3a1d5a67bd66a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -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;
-- 
2.43.0
Re: [RFC PATCH 2/4] kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND
Posted by Tejun Heo 1 year, 11 months ago
On Tue, Jan 16, 2024 at 05:19:27PM +0100, Juri Lelli wrote:
> 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>

Apply 1-2 to wq/for-6.9.

Thanks.

-- 
tejun
Re: [RFC PATCH 2/4] kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND
Posted by Juri Lelli 1 year, 11 months ago
Hello,

On 16/01/24 08:47, Tejun Heo wrote:
> On Tue, Jan 16, 2024 at 05:19:27PM +0100, Juri Lelli wrote:
> > 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>
> 
> Apply 1-2 to wq/for-6.9.

Thank you!

Best,
Juri