• Oleg Nesterov's avatar
    sched: stop the unbound recursion in preempt_schedule_context() · 009f60e2
    Oleg Nesterov authored
    
    
    preempt_schedule_context() does preempt_enable_notrace() at the end
    and this can call the same function again; exception_exit() is heavy
    and it is quite possible that need-resched is true again.
    
    1. Change this code to dec preempt_count() and check need_resched()
       by hand.
    
    2. As Linus suggested, we can use the PREEMPT_ACTIVE bit and avoid
       the enable/disable dance around __schedule(). But in this case
       we need to move into sched/core.c.
    
    3. Cosmetic, but x86 forgets to declare this function. This doesn't
       really matter because it is only called by asm helpers, still it
       make sense to add the declaration into asm/preempt.h to match
       preempt_schedule().
    Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Graf <agraf@suse.de>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Li...
    009f60e2
context_tracking.c 5.71 KB