From: Eric W. Biederman Date: Tue, 21 Dec 2021 17:41:14 +0000 (-0600) Subject: kthread: Warn about failed allocations for the init kthread X-Git-Tag: v6.1-rc5~2203^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd621ee0cf8eb32445c8f5f26d3b7555953071d8;p=platform%2Fkernel%2Flinux-starfive.git kthread: Warn about failed allocations for the init kthread Failed allocates are not expected when setting up the initial task and it is not really possible to handle them either. So I added a warning to report if such an allocation failure ever happens. Correct the sense of the warning so it warns when an allocation failure happens not when the allocation succeeded. Oops. Reported-by: kernel test robot Reported-by: Stephen Rothwell Reported-by: Naresh Kamboju Link: https://lkml.kernel.org/r/20211221231611.785b74cf@canb.auug.org.au Link: https://lkml.kernel.org/r/CA+G9fYvLaR5CF777CKeWTO+qJFTN6vAvm95gtzN+7fw3Wi5hkA@mail.gmail.com Link: https://lkml.kernel.org/r/20211216102956.GC10708@xsang-OptiPlex-9020 Fixes: 40966e316f86 ("kthread: Ensure struct kthread is present for all kthreads") Signed-off-by: "Eric W. Biederman" --- diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0404a8c..ee222b8 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -9425,7 +9425,7 @@ void __init sched_init(void) * if we want to avoid special-casing it in code that deals with per-CPU * kthreads. */ - WARN_ON(set_kthread_struct(current)); + WARN_ON(!set_kthread_struct(current)); /* * Make us the idle thread. Technically, schedule() should not be