mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
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>
This commit is contained in:
parent
038c5bedbc
commit
d28d86a07d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user