History

workqueue: Warn when a rescuer could not be created

Rescuers are created when a workqueue with WQ_MEM_RECLAIM is allocated. It typically happens during the system boot. systemd switches the root filesystem from initrd to the booted system during boot. It kills processes that block the switch for too long. One of the process might be modprobe that tries to create a workqueue. These problems are hard to reproduce. Also alloc_workqueue() does not pass the error code. Make the debugging easier by printing an error, similar to create_worker().

Petr Mladek committed 3 years ago

Commit 4c0736a1 parent 60f54031 file · +6 −1Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+6−1
@@ -4391,13 +4391,18 @@ static int init_rescuer(struct workqueue_struct *wq) · 4390 unmodified lines
4391 return 0;4391 return 0;
4392 4392
4393 rescuer = alloc_worker(NUMA_NO_NODE);4393 rescuer = alloc_worker(NUMA_NO_NODE);
4394 if (!rescuer)4394 if (!rescuer) {
4395 pr_err("workqueue: Failed to allocate a rescuer for wq \"%s\"\n",
4396 wq->name);
4395 return -ENOMEM;4397 return -ENOMEM;
4398 }
4396 4399
4397 rescuer->rescue_wq = wq;4400 rescuer->rescue_wq = wq;
4398 rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);4401 rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
4399 if (IS_ERR(rescuer->task)) {4402 if (IS_ERR(rescuer->task)) {
4400 ret = PTR_ERR(rescuer->task);4403 ret = PTR_ERR(rescuer->task);
4404 pr_err("workqueue: Failed to create a rescuer kthread for wq \"%s\": %pe",
4405 wq->name, ERR_PTR(ret));
4401 kfree(rescuer);4406 kfree(rescuer);
4402 return ret;4407 return ret;
4403 }4408 }