Re: [PATCH] sched: Use printk_deferred_once() instead of WARN_ONCE()

From: Peter Zijlstra
Date: Mon Jan 13 2025 - 08:18:39 EST


On Mon, Jan 13, 2025 at 02:12:43PM +0100, Peter Zijlstra wrote:
> On Fri, Dec 27, 2024 at 05:27:10PM +0800, Maria Yu wrote:
> > A deadlock is observed when WARN_ONCE() uses printk() inside the scheduler
> > logic. printk_deferred_once() is a WARN_ONCE() similar special printk
> > facility for the scheduler to avoid unnecessary deadlocks.
>
> No, problem is with printk. Using delayed will make it so that you'll
> never see the output if it dies.
>
> Only use delayed for printk()s that are expected and non fatal.

Also, if you trip WARN in scheduler, correct thing to do is fix WARN,
not make WARN run 'better'. No WARN, no problem.