Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1632290

[PATCHv2 1/2] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked()

From Mark Rutland <mark.rutland@arm.com>
Newsgroups linux.kernel
Subject [PATCHv2 1/2] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked()
Date 2017-04-27 19:50 +0200
Message-ID <tAVIe-3OA-23@gated-at.bofh.it> (permalink)
References <tAVId-3OA-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Provide static_key_[enable|slow_inc]_cpuslocked() variant that
don't take cpu_hotplug_lock().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: jbaron@akamai.com
---
 include/linux/jump_label.h |  7 +++++++
 kernel/jump_label.c        | 10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index d7b17d1..c80d8b1 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -164,6 +164,7 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
 extern void jump_label_apply_nops(struct module *mod);
 extern int static_key_count(struct static_key *key);
 extern void static_key_enable(struct static_key *key);
+extern void static_key_enable_cpuslocked(struct static_key *key);
 extern void static_key_disable(struct static_key *key);
 extern void static_key_disable_cpuslocked(struct static_key *key);
 
@@ -252,6 +253,11 @@ static inline void static_key_enable(struct static_key *key)
 		static_key_slow_inc(key);
 }
 
+static inline void static_key_enable_cpuslocked(struct static_key *key)
+{
+	static_key_enable(key);
+}
+
 static inline void static_key_disable(struct static_key *key)
 {
 	int count = static_key_count(key);
@@ -429,6 +435,7 @@ struct static_key_false {
  */
 
 #define static_branch_enable(x)			static_key_enable(&(x)->key)
+#define static_branch_enable_cpuslocked(x)	static_key_enable_cpuslocked(&(x)->key)
 #define static_branch_disable(x)		static_key_disable(&(x)->key)
 #define static_branch_disable_cpuslocked(x)	static_key_disable_cpuslocked(&(x)->key)
 
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index d71124e..6343f4c 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -90,6 +90,16 @@ void static_key_enable(struct static_key *key)
 }
 EXPORT_SYMBOL_GPL(static_key_enable);
 
+void static_key_enable_cpuslocked(struct static_key *key)
+{
+	int count = static_key_count(key);
+
+	WARN_ON_ONCE(count < 0 || count > 1);
+
+	if (!count)
+		static_key_slow_inc_cpuslocked(key);
+}
+
 void static_key_disable(struct static_key *key)
 {
 	int count = static_key_count(key);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/2] arm64: fix hotplug rwsem boot fallout Mark Rutland <mark.rutland@arm.com> - 2017-04-27 19:50 +0200
  [PATCHv2 2/2] arm64: cpufeature: use static_branch_enable_cpuslocked() Mark Rutland <mark.rutland@arm.com> - 2017-04-27 19:50 +0200
    Re: [PATCHv2 2/2] arm64: cpufeature: use  static_branch_enable_cpuslocked() Will Deacon <will.deacon@arm.com> - 2017-04-27 20:10 +0200
      Re: [PATCHv2 2/2] arm64: cpufeature: use  static_branch_enable_cpuslocked() Mark Rutland <mark.rutland@arm.com> - 2017-04-28 12:10 +0200
        Re: [PATCHv2 2/2] arm64: cpufeature: use  static_branch_enable_cpuslocked() Will Deacon <will.deacon@arm.com> - 2017-04-28 12:10 +0200
  [PATCHv2 1/2] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked() Mark Rutland <mark.rutland@arm.com> - 2017-04-27 19:50 +0200

csiph-web