aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zyngier <[email protected]>2017-08-01 09:02:54 +0100
committerIngo Molnar <[email protected]>2017-08-10 12:28:58 +0200
commitb70cecf4b6b72a9977576ab32cca0e24f286f517 (patch)
tree5717804168de28067097bedd544c10136603cbbe
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Leo Yan <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
-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)
{
int v, v1;
+ cpus_read_lock();
STATIC_KEY_CHECK_USE();
/*
@@ -99,11 +100,12 @@ void static_key_slow_inc(struct static_key *key)
*/
for (v = atomic_read(&key->enabled); v > 0; v = v1) {
v1 = atomic_cmpxchg(&key->enabled, v, v + 1);
- if (likely(v1 == v))
+ if (likely(v1 == v)) {
+ cpus_read_unlock();
return;
+ }
}
- cpus_read_lock();
jump_label_lock();
if (atomic_read(&key->enabled) == 0) {
atomic_set(&key->enabled, -1);