Skip to contentSkip to conversation

futex: deduplicate resched in futex_wake_op()

PATCH In review Pavel Begunkov 2 participants 2 messages May 17, 2021 – May 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 futex: deduplicate resched in futex_wake_op()

After pagefaulting in futex_wake_op() both branches do cond_resched() before retry. Help to deduplicate it as many compilers can't cope with it.

---
 kernel/futex.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/futex.c +2 -5
index c98b825da9cf..54ed232b2553 100644
@@ -1728,12 +1728,9 @@ futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
 				return ret;
 		}
 
-		if (!(flags & FLAGS_SHARED)) {
-			cond_resched();
-			goto retry_private;
-		}
-
 		cond_resched();
+		if (!(flags & FLAGS_SHARED))
+			goto retry_private;
 		goto retry;
 	}
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Pavel Begunkov

After pagefaulting in futex_wake_op() both branches do cond_resched() before retry. Help to deduplicate it as many compilers can't cope with it.

LGTM:

Quoted 27 lines

---
kernel/futex.c | 7 ++-----

1 file changed, 2 insertions(+), 5 deletions(-)
kernel/futex.c +2 -5
index c98b825da9cf..54ed232b2553 100644
@@ -1728,12 +1728,9 @@ futex_wake_op(u32 __user *uaddr1, unsigned int flags, u32 __user *uaddr2,
 				return ret;
 		}
 
-		if (!(flags & FLAGS_SHARED)) {
-			cond_resched();
-			goto retry_private;
-		}
-
 		cond_resched();
+		if (!(flags & FLAGS_SHARED))
+			goto retry_private;
 		goto retry;
 	}
 
Signature · 1 line
2.31.1