sched: Avoid double preemption in __cond_resched_*lock*()
authorPeter Zijlstra <peterz@infradead.org>
Sat, 25 Dec 2021 00:04:57 +0000 (01:04 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 18 Jan 2022 11:09:59 +0000 (12:09 +0100)
commit7e406d1ff39b8ee574036418a5043c86723170cf
treebe7b54af0c125126592596a0a37b95bb3d875355
parenta315da5e686b02b20c1713dda818e8fb691526bb
sched: Avoid double preemption in __cond_resched_*lock*()

For PREEMPT/DYNAMIC_PREEMPT the *_unlock() will already trigger a
preemption, no point in then calling preempt_schedule_common()
*again*.

Use _cond_resched() instead, since this is a NOP for the preemptible
configs while it provide a preemption point for the others.

Reported-by: xuhaifeng <xuhaifeng@oppo.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/YcGnvDEYBwOiV0cR@hirez.programming.kicks-ass.net
kernel/sched/core.c