diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-11-17 21:25:48 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-02-17 18:32:48 -0500 |
commit | 2f33b512a5460578f6cf11d7b7867bed53157c7c (patch) | |
tree | baa9491f327de99495174da0b6eb9be12b1d8b57 | |
parent | 6d0abeca3242a88cab8232e4acd7e2bf088f3bc2 (diff) |
rcu: Optimize rcu_is_nocb_cpu() for RCU_NOCB_CPU_ALL
If CONFIG_RCU_NOCB_CPU_ALL=y, then rcu_is_nocb_cpu() will always
return true, however, the current version nevertheless checks
rcu_nocb_mask. This commit therefore creates a static inline
implementation of rcu_is_nocb_cpu() that unconditionally returns
true when CONFIG_RCU_NOCB_CPU_ALL=y.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r-- | include/linux/rcupdate.h | 6 | ||||
-rw-r--r-- | kernel/rcu/tree_plugin.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 72bf3a01a4ee..281c90f8989e 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -1015,11 +1015,13 @@ static inline notrace void rcu_read_unlock_sched_notrace(void) | |||
1015 | #define kfree_rcu(ptr, rcu_head) \ | 1015 | #define kfree_rcu(ptr, rcu_head) \ |
1016 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) | 1016 | __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) |
1017 | 1017 | ||
1018 | #ifdef CONFIG_RCU_NOCB_CPU | 1018 | #if defined(CONFIG_RCU_NOCB_CPU_ALL) |
1019 | static inline bool rcu_is_nocb_cpu(int cpu) { return true; } | ||
1020 | #elif defined(CONFIG_RCU_NOCB_CPU) | ||
1019 | bool rcu_is_nocb_cpu(int cpu); | 1021 | bool rcu_is_nocb_cpu(int cpu); |
1020 | #else | 1022 | #else |
1021 | static inline bool rcu_is_nocb_cpu(int cpu) { return false; } | 1023 | static inline bool rcu_is_nocb_cpu(int cpu) { return false; } |
1022 | #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ | 1024 | #endif |
1023 | 1025 | ||
1024 | 1026 | ||
1025 | /* Only for use by adaptive-ticks code. */ | 1027 | /* Only for use by adaptive-ticks code. */ |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 6e2ef4b2b920..39a50b918bff 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -2101,6 +2101,7 @@ static void rcu_init_one_nocb(struct rcu_node *rnp) | |||
2101 | init_waitqueue_head(&rnp->nocb_gp_wq[1]); | 2101 | init_waitqueue_head(&rnp->nocb_gp_wq[1]); |
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | #ifndef CONFIG_RCU_NOCB_CPU_ALL | ||
2104 | /* Is the specified CPU a no-CPUs CPU? */ | 2105 | /* Is the specified CPU a no-CPUs CPU? */ |
2105 | bool rcu_is_nocb_cpu(int cpu) | 2106 | bool rcu_is_nocb_cpu(int cpu) |
2106 | { | 2107 | { |
@@ -2108,6 +2109,7 @@ bool rcu_is_nocb_cpu(int cpu) | |||
2108 | return cpumask_test_cpu(cpu, rcu_nocb_mask); | 2109 | return cpumask_test_cpu(cpu, rcu_nocb_mask); |
2109 | return false; | 2110 | return false; |
2110 | } | 2111 | } |
2112 | #endif /* #ifndef CONFIG_RCU_NOCB_CPU_ALL */ | ||
2111 | 2113 | ||
2112 | /* | 2114 | /* |
2113 | * Enqueue the specified string of rcu_head structures onto the specified | 2115 | * Enqueue the specified string of rcu_head structures onto the specified |