提交 b70cecf4 编写于 作者: M Marc Zyngier 提交者: Ingo Molnar

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: NMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: NPeter 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.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 d0646a6f
...@@ -83,6 +83,7 @@ void static_key_slow_inc(struct static_key *key) ...@@ -83,6 +83,7 @@ void static_key_slow_inc(struct static_key *key)
{ {
int v, v1; int v, v1;
cpus_read_lock();
STATIC_KEY_CHECK_USE(); STATIC_KEY_CHECK_USE();
/* /*
...@@ -99,11 +100,12 @@ void static_key_slow_inc(struct static_key *key) ...@@ -99,11 +100,12 @@ void static_key_slow_inc(struct static_key *key)
*/ */
for (v = atomic_read(&key->enabled); v > 0; v = v1) { for (v = atomic_read(&key->enabled); v > 0; v = v1) {
v1 = atomic_cmpxchg(&key->enabled, v, v + 1); v1 = atomic_cmpxchg(&key->enabled, v, v + 1);
if (likely(v1 == v)) if (likely(v1 == v)) {
cpus_read_unlock();
return; return;
}
} }
cpus_read_lock();
jump_label_lock(); jump_label_lock();
if (atomic_read(&key->enabled) == 0) { if (atomic_read(&key->enabled) == 0) {
atomic_set(&key->enabled, -1); atomic_set(&key->enabled, -1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册