From: Heiko Carstens Date: Wed, 11 Dec 2024 11:58:05 +0000 (+0100) Subject: s390/preempt: Optimize __preempt_count_dec_and_test() X-Git-Tag: v6.14-rc1~200^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c9e37e5233ec3a6b4f2d160c697b8b28d13f134;p=thirdparty%2Fkernel%2Flinux.git s390/preempt: Optimize __preempt_count_dec_and_test() Use __atomic_add_const_and_test() within __preempt_count_dec_and_test(). With this it is possible to decrease preempt_count by one and test if need_resched is set with one instruction, if the compiler has support for flag output operand constraints. Reviewed-by: Juergen Christ Signed-off-by: Heiko Carstens Signed-off-by: Alexander Gordeev --- diff --git a/arch/s390/include/asm/preempt.h b/arch/s390/include/asm/preempt.h index a55e1767b4d43..6ccd033acfe52 100644 --- a/arch/s390/include/asm/preempt.h +++ b/arch/s390/include/asm/preempt.h @@ -87,7 +87,7 @@ static __always_inline void __preempt_count_sub(int val) */ static __always_inline bool __preempt_count_dec_and_test(void) { - return __atomic_add(-1, &get_lowcore()->preempt_count) == 1; + return __atomic_add_const_and_test(-1, &get_lowcore()->preempt_count); } /*