[PATCH] locks should not be needed for reading completion state

From: Nicholas Mc Guire
Date: Fri Jan 16 2015 - 23:14:23 EST


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

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/