]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: sync: atomic: Add i8/i16 xchg and cmpxchg support
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Sun, 28 Dec 2025 12:05:46 +0000 (21:05 +0900)
committerBoqun Feng <boqun.feng@gmail.com>
Fri, 9 Jan 2026 11:01:41 +0000 (19:01 +0800)
commit584f286f822afecc1a6521a27b3caf3e2f515d41
tree895d4b10a785ef15b75826b4651616f2b23f3252
parent7b001c97d9bdaea50e1e1834040c58f7ef9f4e89
rust: sync: atomic: Add i8/i16 xchg and cmpxchg support

Add atomic xchg and cmpxchg operation support for i8 and i16 types
with tests.

Note that since the current implementation of
Atomic::<{i8,i16}>::{load,store}() is READ_ONCE()/WRITE_ONCE()-based.
The atomicity between load/store and xchg/cmpxchg is only guaranteed if
the architecture has native RmW support, hence i8/i16 is currently
AtomicImpl only when CONFIG_ARCH_SUPPORTS_ATOMIC_RWM=y.

[boqun: Make i8/i16 AtomicImpl only when
CONFIG_ARCH_SUPPORTS_ATOMIC_RWM=y]

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20251228120546.1602275-4-fujita.tomonori@gmail.com
rust/kernel/sync/atomic/internal.rs
rust/kernel/sync/atomic/predefine.rs