Message ID | 20201211174559.26010-7-anton.ivanov@cambridgegreys.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [v4,1/7] um: allow the use of glibc functions instead of builtins | expand |
Typo in the subject :) > As a result of switching from emulated to true atomic cmpxchg > we can use cmpxchg in the corresponding um futex op. But this seems odd - maybe just reorder the patches so the futex code can directly have this squashed in? johannes
On 11/12/2020 20:12, Johannes Berg wrote: > Typo in the subject :) > >> As a result of switching from emulated to true atomic cmpxchg >> we can use cmpxchg in the corresponding um futex op. > But this seems odd - maybe just reorder the patches so the futex code > can directly have this squashed in? You do not want to do that if you are still using the generic cmpxchg. That is quite cumbersome. If we reorder the cmpxchg before the futex, then it can be folded in. I will do it in v5 A. > > johannes > > >
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c index de71048b5371..858b2e16e364 100644 --- a/arch/um/kernel/skas/uaccess.c +++ b/arch/um/kernel/skas/uaccess.c @@ -343,7 +343,6 @@ EXPORT_SYMBOL(arch_futex_atomic_op_inuser); * -EAGAIN - Atomic operation was unable to complete due to contention * -ENOSYS - Function not implemented (only if !HAVE_FUTEX_CMPXCHG) */ - int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newval) { @@ -366,8 +365,7 @@ int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, val = *uaddr; - if (val == oldval) - *uaddr = newval; + ret = cmpxchg(uaddr, oldval, newval); *uval = val; pagefault_enable();