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
43914391 return 0;
43924392
43934393 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);
43954397 return -ENOMEM;
4398+ }
43964399
43974400 rescuer->rescue_wq = wq;
43984401 rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
43994402 if (IS_ERR(rescuer->task)) {
44004403 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));
44014406 kfree(rescuer);
44024407 return ret;
44034408 }