linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: locking/core] futex: Deduplicate cond_resched() invocation in futex_wake_op()
@ 2021-05-25 15:35 tip-bot2 for Pavel Begunkov
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Pavel Begunkov @ 2021-05-25 15:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Pavel Begunkov, Thomas Gleixner, Davidlohr Bueso, x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     a82adc7650044b5555d65078bda07866efa4a73d
Gitweb:        https://git.kernel.org/tip/a82adc7650044b5555d65078bda07866efa4a73d
Author:        Pavel Begunkov <asml.silence@gmail.com>
AuthorDate:    Mon, 17 May 2021 14:30:12 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 25 May 2021 17:30:15 +02:00

futex: Deduplicate cond_resched() invocation in futex_wake_op()

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 | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 2f386f0..08008c2 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -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;
 	}
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-25 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 15:35 [tip: locking/core] futex: Deduplicate cond_resched() invocation in futex_wake_op() tip-bot2 for Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).