Skip to content

Commit 4c0736a

Browse files
pmladekhtejun
authored andcommitted
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(). Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 60f5403 commit 4c0736a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

kernel/workqueue.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4391,13 +4391,18 @@ static int init_rescuer(struct workqueue_struct *wq)
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
}

0 commit comments

Comments
 (0)