[RFC 3/5] workqueue: Interrupted create_worker() is not a repeated event

From: Petr Mladek
Date: Wed Feb 01 2023 - 08:46:36 EST


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.

Handle the interrupt a special way. It a one-off event in compare with
the other failures. Always print this warning. And do not block the other
warnings.

Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
---
kernel/workqueue.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ab109ef7a7c0..5f3327e119b4 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1925,7 +1925,7 @@ void __print_create_worker_failure(long err, const char *fmt, ...)
* touch watchdogs so that more frequent messages would prevent
* reaching the watchdog thresh.
*/
- if (!create_worker_failed) {
+ if (!create_worker_failed || err == -EINTR) {
va_list args;

va_start(args, fmt);
@@ -1933,7 +1933,8 @@ void __print_create_worker_failure(long err, const char *fmt, ...)
va_end(args);
}

- create_worker_failed++;
+ if (err != -EINTR)
+ create_worker_failed++;

spin_unlock_irq(&create_worker_failed_lock);
}
--
2.35.3