diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-03-17 16:51:41 +0300 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2023-03-20 13:12:49 +0300 |
commit | d28d86a07dbca4b6e33032196ef4a9a7121181b4 (patch) | |
tree | adb2709f82c814ccfb3dea39f903317c1c6b77aa /arch/s390 | |
parent | 038c5bedbc313b55f66b26fda5a7808727c2f177 (diff) | |
download | linux-d28d86a07dbca4b6e33032196ef4a9a7121181b4.tar.xz |
s390/mm: make use of atomic_fetch_xor()
Make use of atomic_fetch_xor() instead of an atomic_cmpxchg() loop to
implement atomic_xor_bits() (aka atomic_xor_return()). This makes the C
code more readable and in addition generates better code, since for z196
and newer a single lax instruction is generated instead of a cmpxchg()
loop.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/mm/pgalloc.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 0f68b7257e08..66ab68db9842 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -133,13 +133,7 @@ err_p4d: static inline unsigned int atomic_xor_bits(atomic_t *v, unsigned int bits) { - unsigned int old, new; - - do { - old = atomic_read(v); - new = old ^ bits; - } while (atomic_cmpxchg(v, old, new) != old); - return new; + return atomic_fetch_xor(bits, v) ^ bits; } #ifdef CONFIG_PGSTE |