Re: [patch 17/18] sched: Enable might_sleep() checks early

Steven Rostedt
2017-05-16T13:14:19Z

On Tue, 16 May 2017 09:33:52 +0200 (CEST)
Thomas Gleixner <tglx@linutronix.de> wrote:

> Darn, forgot about PREEMPT_VOLUNTARY and that excellent changelog does not
> mention it either.
>
> > So if we schedule to the kernel_init() task before we set kthreadd_task
> > we'll try and spawn kthreads and OOPS.
>
> So back to Stevens question. No, we can't set the state earlier than right
> before schedule() simply because with PREEMPT preemption _is_ actually
> disabled and kernel_kthread() will trigger might_sleep() splats.

So a comment in the code mentioning PREEMPT_VOLUNTARY might be
advantageous.

>
> What a mess.

Indeed.

-- Steve