[PATCH v4 6/7] um: swithch futex ops to cmpxchg

anton.ivanov
2020-12-11T17:46:27Z

From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

As a result of switching from emulated to true atomic cmpxchg
we can use cmpxchg in the corresponding um futex op.

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
arch/um/kernel/skas/uaccess.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

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();
--
2.20.1