futex: Deduplicate cond_resched() invocation in futex_wake_op()
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 17 May 2021 13:30:12 +0000 (14:30 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 25 May 2021 15:30:15 +0000 (17:30 +0200)
After pagefaulting in futex_wake_op() both branches do cond_resched()
before retry. Deduplicate it as compilers cannot figure it out themself.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Davidlohr Bueso <dbueso@suse.de>
Link: https://lore.kernel.org/r/9b2588c1fd33c91fb01c4e348a3b647ab2c8baab.1621258128.git.asml.silence@gmail.com
kernel/futex.c

index 2f386f0129001da3ee5c69bc8b4d7e1f62d79fee..08008c225bec06c34b66539e30ffae5efc788044 100644 (file)
@@ -1728,12 +1728,9 @@ retry_private:
                                return ret;
                }
 
-               if (!(flags & FLAGS_SHARED)) {
-                       cond_resched();
-                       goto retry_private;
-               }
-
                cond_resched();
+               if (!(flags & FLAGS_SHARED))
+                       goto retry_private;
                goto retry;
        }