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

From: Steven Rostedt
Date: Tue May 16 2017 - 09:14:27 EST


On Tue, 16 May 2017 09:33:52 +0200 (CEST)
Thomas Gleixner <tglx@xxxxxxxxxxxxx> 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