Skip to content

Commit 60f5403

Browse files
pmladekhtejun
authored andcommitted
workqueue: Interrupted create_worker() is not a repeated event
kthread_create_on_node() might get interrupted(). It is rare but realistic. For example, when an unbound workqueue is allocated in module_init() callback. It is done in the context of the "modprobe" process. And, for example, systemd might kill pending processes when switching root from initrd to the booted system. The interrupt is a one-off event and the race might be hard to reproduce. It is always worth printing. Signed-off-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 3f0ea0b commit 60f5403

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

kernel/workqueue.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,13 @@ static struct worker *create_worker(struct worker_pool *pool)
19591959
worker->task = kthread_create_on_node(worker_thread, worker, pool->node,
19601960
"kworker/%s", id_buf);
19611961
if (IS_ERR(worker->task)) {
1962-
pr_err_once("workqueue: Failed to create a worker thread: %pe",
1963-
worker->task);
1962+
if (PTR_ERR(worker->task) == -EINTR) {
1963+
pr_err("workqueue: Interrupted when creating a worker thread \"kworker/%s\"\n",
1964+
id_buf);
1965+
} else {
1966+
pr_err_once("workqueue: Failed to create a worker thread: %pe",
1967+
worker->task);
1968+
}
19641969
goto fail;
19651970
}
19661971

0 commit comments

Comments
 (0)