sched: Avoid double preemption in __cond_resched_*lock*()
authorPeter Zijlstra <peterz@infradead.org>
Sat, 25 Dec 2021 00:04:57 +0000 (01:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Feb 2022 11:56:11 +0000 (12:56 +0100)
commit85008bde411d5be480d3926ec3fb26b93d46001f
tree148e6f3f179b155dd902b5649a6f73b509cd6dee
parentec903b6daa586dedff31c27d6b7d8d84cbd11131
sched: Avoid double preemption in __cond_resched_*lock*()

[ Upstream commit 7e406d1ff39b8ee574036418a5043c86723170cf ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/core.c