[PATCH RFC] arm64: Mark set_preempt_need_resched() access to .need_resched
Paul E. McKenney
paulmck at kernel.org
Thu Jul 30 16:59:57 PDT 2026
The .need_resched field can be accessed from both task level and
from interrrupt handlers, so apply WRITE_ONCE() to the update in
set_preempt_need_resched(). This also brings arm64 in line with s390
(which uses atomic operations) and x86 (which uses inline assembly).
Other architectures avoid this issue via the empty definition in
include/asm-generic/preempt.h.
KCSAN located this issue.
Signed-off-by: Paul E. McKenney <paulmck at kernel.org>
Cc: Catalin Marinas <catalin.marinas at arm.com>
Cc: Will Deacon <will at kernel.org>
Cc: Jinjie Ruan <ruanjinjie at huawei.com>
Cc: Ada Couprie Diaz <ada.coupriediaz at arm.com>
Cc: <linux-arm-kernel at lists.infradead.org>
---
preempt.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/preempt.h b/arch/arm64/include/asm/preempt.h
index 932ea4b6204289..610853da140a78 100644
--- a/arch/arm64/include/asm/preempt.h
+++ b/arch/arm64/include/asm/preempt.h
@@ -28,7 +28,7 @@ static inline void preempt_count_set(u64 pc)
static inline void set_preempt_need_resched(void)
{
- current_thread_info()->preempt.need_resched = 0;
+ WRITE_ONCE(current_thread_info()->preempt.need_resched, 0);
}
static inline void clear_preempt_need_resched(void)
More information about the linux-arm-kernel
mailing list