Commit 449b31ad authored by Lai Jiangshan's avatar Lai Jiangshan Committed by Tejun Heo

workqueue: Init rescuer's affinities as the wq's effective cpumask

Make it consistent with apply_wqattrs_commit().

Link: https://lore.kernel.org/lkml/20240203154334.791910-5-longman@redhat.com/
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: default avatarLai Jiangshan <jiangshan.ljs@antgroup.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 1726a171
...@@ -5516,6 +5516,8 @@ static int init_rescuer(struct workqueue_struct *wq) ...@@ -5516,6 +5516,8 @@ static int init_rescuer(struct workqueue_struct *wq)
struct worker *rescuer; struct worker *rescuer;
int ret; int ret;
lockdep_assert_held(&wq_pool_mutex);
if (!(wq->flags & WQ_MEM_RECLAIM)) if (!(wq->flags & WQ_MEM_RECLAIM))
return 0; return 0;
...@@ -5538,7 +5540,7 @@ static int init_rescuer(struct workqueue_struct *wq) ...@@ -5538,7 +5540,7 @@ static int init_rescuer(struct workqueue_struct *wq)
wq->rescuer = rescuer; wq->rescuer = rescuer;
if (wq->flags & WQ_UNBOUND) if (wq->flags & WQ_UNBOUND)
kthread_bind_mask(rescuer->task, wq_unbound_cpumask); kthread_bind_mask(rescuer->task, unbound_effective_cpumask(wq));
else else
kthread_bind_mask(rescuer->task, cpu_possible_mask); kthread_bind_mask(rescuer->task, cpu_possible_mask);
wake_up_process(rescuer->task); wake_up_process(rescuer->task);
...@@ -5702,10 +5704,10 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, ...@@ -5702,10 +5704,10 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
list_add_tail_rcu(&wq->list, &workqueues); list_add_tail_rcu(&wq->list, &workqueues);
apply_wqattrs_unlock();
if (wq_online && init_rescuer(wq) < 0) if (wq_online && init_rescuer(wq) < 0)
goto err_destroy; goto err_unlock_destroy;
apply_wqattrs_unlock();
if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq)) if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq))
goto err_destroy; goto err_destroy;
...@@ -5730,6 +5732,8 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, ...@@ -5730,6 +5732,8 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
free_workqueue_attrs(wq->unbound_attrs); free_workqueue_attrs(wq->unbound_attrs);
kfree(wq); kfree(wq);
return NULL; return NULL;
err_unlock_destroy:
apply_wqattrs_unlock();
err_destroy: err_destroy:
destroy_workqueue(wq); destroy_workqueue(wq);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment