aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2018-01-08 08:38:37 -0500
committerTejun Heo <tj@kernel.org>2018-01-08 08:38:37 -0500
commit40c17f75dfa9ec163478efd3f7443fd6af9992c9 (patch)
tree92ad5e8e9475b19306fea16c42bde00059c15fb9 /kernel/workqueue.c
parent983c751532738b83c4c5b51192ebc6fbfe9330f7 (diff)
workqueue: allow WQ_MEM_RECLAIM on early init workqueues
Workqueues can be created early during boot before workqueue subsystem in fully online - work items are queued waiting for later full initialization. However, early init wasn't supported for WQ_MEM_RECLAIM workqueues causing unnecessary annoyances for a subset of users. Expand early init support to include WQ_MEM_RECLAIM workqueues. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 5baac7c8a5f9..c86cc1ed678b 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4032,7 +4032,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
4032 if (alloc_and_link_pwqs(wq) < 0) 4032 if (alloc_and_link_pwqs(wq) < 0)
4033 goto err_free_wq; 4033 goto err_free_wq;
4034 4034
4035 if (init_rescuer(wq) < 0) 4035 if (wq_online && init_rescuer(wq) < 0)
4036 goto err_destroy; 4036 goto err_destroy;
4037 4037
4038 if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq)) 4038 if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq))
@@ -5639,6 +5639,8 @@ int __init workqueue_init(void)
5639 * archs such as power and arm64. As per-cpu pools created 5639 * archs such as power and arm64. As per-cpu pools created
5640 * previously could be missing node hint and unbound pools NUMA 5640 * previously could be missing node hint and unbound pools NUMA
5641 * affinity, fix them up. 5641 * affinity, fix them up.
5642 *
5643 * Also, while iterating workqueues, create rescuers if requested.
5642 */ 5644 */
5643 wq_numa_init(); 5645 wq_numa_init();
5644 5646
@@ -5650,8 +5652,12 @@ int __init workqueue_init(void)
5650 } 5652 }
5651 } 5653 }
5652 5654
5653 list_for_each_entry(wq, &workqueues, list) 5655 list_for_each_entry(wq, &workqueues, list) {
5654 wq_update_unbound_numa(wq, smp_processor_id(), true); 5656 wq_update_unbound_numa(wq, smp_processor_id(), true);
5657 WARN(init_rescuer(wq),
5658 "workqueue: failed to create early rescuer for %s",
5659 wq->name);
5660 }
5655 5661
5656 mutex_unlock(&wq_pool_mutex); 5662 mutex_unlock(&wq_pool_mutex);
5657 5663