Re: [PATCH v2] exit: Move preemption fixup up, move blocking operations down

From: Jann Horn
Date: Tue Mar 24 2020 - 05:30:33 EST


On Thu, Mar 5, 2020 at 11:07 PM Jann Horn <jannh@xxxxxxxxxx> wrote:
> With CONFIG_DEBUG_ATOMIC_SLEEP=y and CONFIG_CGROUPS=y, kernel oopses in
> non-preemptible context look untidy; after the main oops, the kernel prints
> a "sleeping function called from invalid context" report because
> exit_signals() -> cgroup_threadgroup_change_begin() -> percpu_down_read()
> can sleep, and that happens before the preempt_count_set(PREEMPT_ENABLED)
> fixup.
>
> It looks like the same thing applies to profile_task_exit() and
> kcov_task_exit().
>
> Fix it by moving the preemption fixup up and the calls to
> profile_task_exit() and kcov_task_exit() down.
>
> Fixes: 1dc0fffc48af ("sched/core: Robustify preemption leak checks")
> Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
> ---
> As so often, I have no idea which tree this should go through. tip? mm?

Do the tip folks want to take this, since it's vaguely locking-related
and the fixed commit also came that way? Or should it go through
akpm's tree?