diff options
-rw-r--r-- | include/linux/cpuset.h | 7 | ||||
-rw-r--r-- | kernel/cpuset.c | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 85a868ccb493..8397dc235e84 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -16,6 +16,7 @@ #ifdef CONFIG_CPUSETS +extern struct static_key cpusets_pre_enable_key; extern struct static_key cpusets_enabled_key; static inline bool cpusets_enabled(void) { @@ -30,12 +31,14 @@ static inline int nr_cpusets(void) static inline void cpuset_inc(void) { + static_key_slow_inc(&cpusets_pre_enable_key); static_key_slow_inc(&cpusets_enabled_key); } static inline void cpuset_dec(void) { static_key_slow_dec(&cpusets_enabled_key); + static_key_slow_dec(&cpusets_pre_enable_key); } extern int cpuset_init(void); @@ -104,7 +107,7 @@ extern void cpuset_print_current_mems_allowed(void); */ static inline unsigned int read_mems_allowed_begin(void) { - if (!cpusets_enabled()) + if (!static_key_false(&cpusets_pre_enable_key)) return 0; return read_seqcount_begin(¤t->mems_allowed_seq); @@ -118,7 +121,7 @@ static inline unsigned int read_mems_allowed_begin(void) */ static inline bool read_mems_allowed_retry(unsigned int seq) { - if (!cpusets_enabled()) + if (!static_key_false(&cpusets_enabled_key)) return false; return read_seqcount_retry(¤t->mems_allowed_seq, seq); diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 3b5e5430f5d0..8ccd66a97c8b 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c @@ -60,6 +60,7 @@ #include <linux/cgroup.h> #include <linux/wait.h> +struct static_key cpusets_pre_enable_key __read_mostly = STATIC_KEY_INIT_FALSE; struct static_key cpusets_enabled_key __read_mostly = STATIC_KEY_INIT_FALSE; /* See "Frequency meter" comments, below. */ |