aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-08-13 19:16:25 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-08-20 12:00:13 -0400
commita3dc3fb161f9b4066c0fce22db72638af8baf83b (patch)
treee41a30edd7e4965807b199da7637a6d6e44d4ed1
parent53d84e004d5e8c018be395c4330dc72fd60bd13e (diff)
rcu: repair code-duplication FIXMEs
Combine the duplicate definitions of ULONG_CMP_GE(), ULONG_CMP_LT(), and rcu_preempt_depth() into include/linux/rcupdate.h. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--include/linux/rcupdate.h15
-rw-r--r--include/linux/rcutiny.h7
-rw-r--r--include/linux/rcutree.h6
-rw-r--r--kernel/rcutiny_plugin.h4
-rw-r--r--kernel/rcutree.h3
5 files changed, 15 insertions, 20 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d7af96ef6fcf..325bad7bbca9 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -47,6 +47,9 @@
47extern int rcutorture_runnable; /* for sysctl */ 47extern int rcutorture_runnable; /* for sysctl */
48#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 48#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
49 49
50#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
51#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b))
52
50/** 53/**
51 * struct rcu_head - callback structure for use with RCU 54 * struct rcu_head - callback structure for use with RCU
52 * @next: next update requests in a list 55 * @next: next update requests in a list
@@ -66,6 +69,18 @@ extern int sched_expedited_torture_stats(char *page);
66/* Internal to kernel */ 69/* Internal to kernel */
67extern void rcu_init(void); 70extern void rcu_init(void);
68 71
72#ifdef CONFIG_PREEMPT_RCU
73
74/*
75 * Defined as a macro as it is a very low level header included from
76 * areas that don't even know about current. This gives the rcu_read_lock()
77 * nesting depth, but makes sense only if CONFIG_PREEMPT_RCU -- in other
78 * types of kernel builds, the rcu_read_lock() nesting depth is unknowable.
79 */
80#define rcu_preempt_depth() (current->rcu_read_lock_nesting)
81
82#endif /* #ifdef CONFIG_PREEMPT_RCU */
83
69#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 84#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
70#include <linux/rcutree.h> 85#include <linux/rcutree.h>
71#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 86#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 3fa179784e18..c6b11dc5ba0a 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -133,13 +133,6 @@ static inline int rcu_needs_cpu(int cpu)
133 return rcu_preempt_needs_cpu(); 133 return rcu_preempt_needs_cpu();
134} 134}
135 135
136/*
137 * Defined as macro as it is a very low level header
138 * included from areas that don't even know about current
139 * FIXME: combine with include/linux/rcutree.h into rcupdate.h.
140 */
141#define rcu_preempt_depth() (current->rcu_read_lock_nesting)
142
143#endif /* #else #ifdef CONFIG_TINY_RCU */ 136#endif /* #else #ifdef CONFIG_TINY_RCU */
144 137
145static inline void rcu_note_context_switch(int cpu) 138static inline void rcu_note_context_switch(int cpu)
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 0726809497ba..54a20c11f98d 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -45,12 +45,6 @@ extern void __rcu_read_unlock(void);
45extern void synchronize_rcu(void); 45extern void synchronize_rcu(void);
46extern void exit_rcu(void); 46extern void exit_rcu(void);
47 47
48/*
49 * Defined as macro as it is a very low level header
50 * included from areas that don't even know about current
51 */
52#define rcu_preempt_depth() (current->rcu_read_lock_nesting)
53
54#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ 48#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
55 49
56static inline void __rcu_read_lock(void) 50static inline void __rcu_read_lock(void)
diff --git a/kernel/rcutiny_plugin.h b/kernel/rcutiny_plugin.h
index e6bc1b447c6c..c5bea1137dcb 100644
--- a/kernel/rcutiny_plugin.h
+++ b/kernel/rcutiny_plugin.h
@@ -26,10 +26,6 @@
26 26
27#include <linux/delay.h> 27#include <linux/delay.h>
28 28
29/* FIXME: merge with definitions in kernel/rcutree.h. */
30#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
31#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b))
32
33/* Global control variables for preemptible RCU. */ 29/* Global control variables for preemptible RCU. */
34struct rcu_preempt_ctrlblk { 30struct rcu_preempt_ctrlblk {
35 struct rcu_ctrlblk rcb; /* curtail: ->next ptr of last CB for GP. */ 31 struct rcu_ctrlblk rcb; /* curtail: ->next ptr of last CB for GP. */
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 7abd439a7573..7918ba61873f 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -272,9 +272,6 @@ struct rcu_data {
272 272
273#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ 273#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
274 274
275#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
276#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b))
277
278/* 275/*
279 * RCU global state, including node hierarchy. This hierarchy is 276 * RCU global state, including node hierarchy. This hierarchy is
280 * represented in "heap" form in a dense array. The root (first level) 277 * represented in "heap" form in a dense array. The root (first level)