summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLai Jiangshan <jiangshan.ljs@antgroup.com>2024-07-04 05:49:14 +0200
committerTejun Heo <tj@kernel.org>2024-07-05 21:14:40 +0200
commit449b31ad2937406981685348ad75abefb1f63cba (patch)
treea581da47ff8c1a691fe45d87dab366746585d3b4 /kernel/workqueue.c
parentworkqueue: Put PWQ allocation and WQ enlistment in the same lock C.S. (diff)
downloadlinux-449b31ad2937406981685348ad75abefb1f63cba.tar.xz
linux-449b31ad2937406981685348ad75abefb1f63cba.zip
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: Lai Jiangshan <jiangshan.ljs@antgroup.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0c06ffd0174e..4337910cc034 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5516,6 +5516,8 @@ static int init_rescuer(struct workqueue_struct *wq)
struct worker *rescuer;
int ret;
+ lockdep_assert_held(&wq_pool_mutex);
+
if (!(wq->flags & WQ_MEM_RECLAIM))
return 0;
@@ -5538,7 +5540,7 @@ static int init_rescuer(struct workqueue_struct *wq)
wq->rescuer = rescuer;
if (wq->flags & WQ_UNBOUND)
- kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
+ kthread_bind_mask(rescuer->task, unbound_effective_cpumask(wq));
else
kthread_bind_mask(rescuer->task, cpu_possible_mask);
wake_up_process(rescuer->task);
@@ -5702,10 +5704,10 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
list_add_tail_rcu(&wq->list, &workqueues);
- apply_wqattrs_unlock();
-
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))
goto err_destroy;
@@ -5730,6 +5732,8 @@ err_free_wq:
free_workqueue_attrs(wq->unbound_attrs);
kfree(wq);
return NULL;
+err_unlock_destroy:
+ apply_wqattrs_unlock();
err_destroy:
destroy_workqueue(wq);
return NULL;