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

anton.ivanov at cambridgegreys.com anton.ivanov at cambridgegreys.com
Fri Dec 11 12:45:58 EST 2020


From: Anton Ivanov <anton.ivanov at 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 at 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




More information about the linux-um mailing list