Skip to content

Commit 449b31a

Browse files
Lai Jiangshanhtejun
authored andcommitted
workqueue: Init rescuer's affinities as the wq's effective cpumask
Make it consistent with apply_wqattrs_commit(). Link: https://lore.kernel.org/lkml/[email protected]/ Cc: Juri Lelli <[email protected]> Cc: Waiman Long <[email protected]> Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 1726a17 commit 449b31a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kernel/workqueue.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5516,6 +5516,8 @@ static int init_rescuer(struct workqueue_struct *wq)
55165516
struct worker *rescuer;
55175517
int ret;
55185518

5519+
lockdep_assert_held(&wq_pool_mutex);
5520+
55195521
if (!(wq->flags & WQ_MEM_RECLAIM))
55205522
return 0;
55215523

@@ -5538,7 +5540,7 @@ static int init_rescuer(struct workqueue_struct *wq)
55385540

55395541
wq->rescuer = rescuer;
55405542
if (wq->flags & WQ_UNBOUND)
5541-
kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
5543+
kthread_bind_mask(rescuer->task, unbound_effective_cpumask(wq));
55425544
else
55435545
kthread_bind_mask(rescuer->task, cpu_possible_mask);
55445546
wake_up_process(rescuer->task);
@@ -5702,10 +5704,10 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
57025704

57035705
list_add_tail_rcu(&wq->list, &workqueues);
57045706

5705-
apply_wqattrs_unlock();
5706-
57075707
if (wq_online && init_rescuer(wq) < 0)
5708-
goto err_destroy;
5708+
goto err_unlock_destroy;
5709+
5710+
apply_wqattrs_unlock();
57095711

57105712
if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq))
57115713
goto err_destroy;
@@ -5730,6 +5732,8 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
57305732
free_workqueue_attrs(wq->unbound_attrs);
57315733
kfree(wq);
57325734
return NULL;
5735+
err_unlock_destroy:
5736+
apply_wqattrs_unlock();
57335737
err_destroy:
57345738
destroy_workqueue(wq);
57355739
return NULL;

0 commit comments

Comments
 (0)