summaryrefslogtreecommitdiffstats
path: root/kernel/jump_label.c
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2017-08-01 04:02:54 -0400
committerIngo Molnar <mingo@kernel.org>2017-08-10 06:28:58 -0400
commitb70cecf4b6b72a9977576ab32cca0e24f286f517 (patch)
tree5717804168de28067097bedd544c10136603cbbe /kernel/jump_label.c
parentd0646a6f5533226ceb7620c20717286d3a372794 (diff)
jump_label: Move CPU hotplug locking
As we're about to rework the locking, let's move the taking and release of the CPU hotplug lock to locations that will make its reworking completely obvious. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20170801080257.5056-2-marc.zyngier@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/jump_label.c')
-rw-r--r--kernel/jump_label.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index f2ea678c269f..161301fff97d 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -83,6 +83,7 @@ void static_key_slow_inc(struct static_key *key)
83{ 83{
84 int v, v1; 84 int v, v1;
85 85
86 cpus_read_lock();
86 STATIC_KEY_CHECK_USE(); 87 STATIC_KEY_CHECK_USE();
87 88
88 /* 89 /*
@@ -99,11 +100,12 @@ void static_key_slow_inc(struct static_key *key)
99 */ 100 */
100 for (v = atomic_read(&key->enabled); v > 0; v = v1) { 101 for (v = atomic_read(&key->enabled); v > 0; v = v1) {
101 v1 = atomic_cmpxchg(&key->enabled, v, v + 1); 102 v1 = atomic_cmpxchg(&key->enabled, v, v + 1);
102 if (likely(v1 == v)) 103 if (likely(v1 == v)) {
104 cpus_read_unlock();
103 return; 105 return;
106 }
104 } 107 }
105 108
106 cpus_read_lock();
107 jump_label_lock(); 109 jump_label_lock();
108 if (atomic_read(&key->enabled) == 0) { 110 if (atomic_read(&key->enabled) == 0) {
109 atomic_set(&key->enabled, -1); 111 atomic_set(&key->enabled, -1);