public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] locks should not be needed for reading completion state
@ 2015-01-17  4:05 Nicholas Mc Guire
  2015-02-04 14:37 ` [tip:locking/core] sched/completion: Remove unnecessary -> wait.lock serialization when " tip-bot for Nicholas Mc Guire
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-01-17  4:05 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel, Nicholas Mc Guire

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---

Should that not be enough to wrap it into ACCESS_ONCE() here ?

Not a wild performance benefit - but might be worth it anyway

 kernel/sched/completion.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
index 607f852..7c5cd70 100644
--- a/kernel/sched/completion.c
+++ b/kernel/sched/completion.c
@@ -288,13 +288,6 @@ EXPORT_SYMBOL(try_wait_for_completion);
  */
 bool completion_done(struct completion *x)
 {
-	unsigned long flags;
-	int ret = 1;
-
-	spin_lock_irqsave(&x->wait.lock, flags);
-	if (!x->done)
-		ret = 0;
-	spin_unlock_irqrestore(&x->wait.lock, flags);
-	return ret;
+	return !ACCESS_ONCE(x->done);
 }
 EXPORT_SYMBOL(completion_done);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-04 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-17  4:05 [PATCH] locks should not be needed for reading completion state Nicholas Mc Guire
2015-02-04 14:37 ` [tip:locking/core] sched/completion: Remove unnecessary -> wait.lock serialization when " tip-bot for Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox