[RFC PATCH 1/2] membarrier: speed up single-threaded private cmd
From: Mathieu Desnoyers
Date: Sun Aug 27 2017 - 15:54:52 EST
Single-threaded processes don't need to issue barriers, since the
thread's current CPU is the only one that matters.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CC: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
CC: Boqun Feng <boqun.feng@xxxxxxxxx>
CC: Andrew Hunter <ahh@xxxxxxxxxx>
CC: Maged Michael <maged.michael@xxxxxxxxx>
CC: gromer@xxxxxxxxxx
CC: Avi Kivity <avi@xxxxxxxxxxxx>
CC: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
CC: Paul Mackerras <paulus@xxxxxxxxx>
CC: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
CC: Dave Watson <davejwatson@xxxxxx>
---
kernel/sched/membarrier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c
index a92fddc22747..7eec6914d2d2 100644
--- a/kernel/sched/membarrier.c
+++ b/kernel/sched/membarrier.c
@@ -39,7 +39,7 @@ static void membarrier_private_expedited(void)
bool fallback = false;
cpumask_var_t tmpmask;
- if (num_online_cpus() == 1)
+ if (num_online_cpus() == 1 || get_nr_threads(current) == 1)
return;
/*
--
2.11.0