diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-08-22 16:56:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-23 04:32:36 -0400 |
commit | 9f77da9f40045253e91f55c12d4481254b513d2d (patch) | |
tree | 8699c413d1493855ca8b1205e1b63090f568af42 /include/linux/rcutree.h | |
parent | b560d8ad8583803978aaaeba50ef29dc8e97a610 (diff) |
rcu: Move private definitions from include/linux/rcutree.h to kernel/rcutree.h
Some information hiding that makes it easier to merge
preemptability into rcutree without descending into #include
hell.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: akpm@linux-foundation.org
Cc: mathieu.desnoyers@polymtl.ca
Cc: josht@linux.vnet.ibm.com
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
LKML-Reference: <1250974613373-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/rcutree.h')
-rw-r--r-- | include/linux/rcutree.h | 211 |
1 files changed, 0 insertions, 211 deletions
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index d4dfd2489633..e37d5e2a8353 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
@@ -30,217 +30,6 @@ | |||
30 | #ifndef __LINUX_RCUTREE_H | 30 | #ifndef __LINUX_RCUTREE_H |
31 | #define __LINUX_RCUTREE_H | 31 | #define __LINUX_RCUTREE_H |
32 | 32 | ||
33 | #include <linux/cache.h> | ||
34 | #include <linux/spinlock.h> | ||
35 | #include <linux/threads.h> | ||
36 | #include <linux/cpumask.h> | ||
37 | #include <linux/seqlock.h> | ||
38 | |||
39 | /* | ||
40 | * Define shape of hierarchy based on NR_CPUS and CONFIG_RCU_FANOUT. | ||
41 | * In theory, it should be possible to add more levels straightforwardly. | ||
42 | * In practice, this has not been tested, so there is probably some | ||
43 | * bug somewhere. | ||
44 | */ | ||
45 | #define MAX_RCU_LVLS 3 | ||
46 | #define RCU_FANOUT (CONFIG_RCU_FANOUT) | ||
47 | #define RCU_FANOUT_SQ (RCU_FANOUT * RCU_FANOUT) | ||
48 | #define RCU_FANOUT_CUBE (RCU_FANOUT_SQ * RCU_FANOUT) | ||
49 | |||
50 | #if NR_CPUS <= RCU_FANOUT | ||
51 | # define NUM_RCU_LVLS 1 | ||
52 | # define NUM_RCU_LVL_0 1 | ||
53 | # define NUM_RCU_LVL_1 (NR_CPUS) | ||
54 | # define NUM_RCU_LVL_2 0 | ||
55 | # define NUM_RCU_LVL_3 0 | ||
56 | #elif NR_CPUS <= RCU_FANOUT_SQ | ||
57 | # define NUM_RCU_LVLS 2 | ||
58 | # define NUM_RCU_LVL_0 1 | ||
59 | # define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT - 1) / RCU_FANOUT) | ||
60 | # define NUM_RCU_LVL_2 (NR_CPUS) | ||
61 | # define NUM_RCU_LVL_3 0 | ||
62 | #elif NR_CPUS <= RCU_FANOUT_CUBE | ||
63 | # define NUM_RCU_LVLS 3 | ||
64 | # define NUM_RCU_LVL_0 1 | ||
65 | # define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT_SQ - 1) / RCU_FANOUT_SQ) | ||
66 | # define NUM_RCU_LVL_2 (((NR_CPUS) + (RCU_FANOUT) - 1) / (RCU_FANOUT)) | ||
67 | # define NUM_RCU_LVL_3 NR_CPUS | ||
68 | #else | ||
69 | # error "CONFIG_RCU_FANOUT insufficient for NR_CPUS" | ||
70 | #endif /* #if (NR_CPUS) <= RCU_FANOUT */ | ||
71 | |||
72 | #define RCU_SUM (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3) | ||
73 | #define NUM_RCU_NODES (RCU_SUM - NR_CPUS) | ||
74 | |||
75 | /* | ||
76 | * Dynticks per-CPU state. | ||
77 | */ | ||
78 | struct rcu_dynticks { | ||
79 | int dynticks_nesting; /* Track nesting level, sort of. */ | ||
80 | int dynticks; /* Even value for dynticks-idle, else odd. */ | ||
81 | int dynticks_nmi; /* Even value for either dynticks-idle or */ | ||
82 | /* not in nmi handler, else odd. So this */ | ||
83 | /* remains even for nmi from irq handler. */ | ||
84 | }; | ||
85 | |||
86 | /* | ||
87 | * Definition for node within the RCU grace-period-detection hierarchy. | ||
88 | */ | ||
89 | struct rcu_node { | ||
90 | spinlock_t lock; | ||
91 | unsigned long qsmask; /* CPUs or groups that need to switch in */ | ||
92 | /* order for current grace period to proceed.*/ | ||
93 | unsigned long qsmaskinit; | ||
94 | /* Per-GP initialization for qsmask. */ | ||
95 | unsigned long grpmask; /* Mask to apply to parent qsmask. */ | ||
96 | int grplo; /* lowest-numbered CPU or group here. */ | ||
97 | int grphi; /* highest-numbered CPU or group here. */ | ||
98 | u8 grpnum; /* CPU/group number for next level up. */ | ||
99 | u8 level; /* root is at level 0. */ | ||
100 | struct rcu_node *parent; | ||
101 | } ____cacheline_internodealigned_in_smp; | ||
102 | |||
103 | /* Index values for nxttail array in struct rcu_data. */ | ||
104 | #define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */ | ||
105 | #define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */ | ||
106 | #define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */ | ||
107 | #define RCU_NEXT_TAIL 3 | ||
108 | #define RCU_NEXT_SIZE 4 | ||
109 | |||
110 | /* Per-CPU data for read-copy update. */ | ||
111 | struct rcu_data { | ||
112 | /* 1) quiescent-state and grace-period handling : */ | ||
113 | long completed; /* Track rsp->completed gp number */ | ||
114 | /* in order to detect GP end. */ | ||
115 | long gpnum; /* Highest gp number that this CPU */ | ||
116 | /* is aware of having started. */ | ||
117 | long passed_quiesc_completed; | ||
118 | /* Value of completed at time of qs. */ | ||
119 | bool passed_quiesc; /* User-mode/idle loop etc. */ | ||
120 | bool qs_pending; /* Core waits for quiesc state. */ | ||
121 | bool beenonline; /* CPU online at least once. */ | ||
122 | struct rcu_node *mynode; /* This CPU's leaf of hierarchy */ | ||
123 | unsigned long grpmask; /* Mask to apply to leaf qsmask. */ | ||
124 | |||
125 | /* 2) batch handling */ | ||
126 | /* | ||
127 | * If nxtlist is not NULL, it is partitioned as follows. | ||
128 | * Any of the partitions might be empty, in which case the | ||
129 | * pointer to that partition will be equal to the pointer for | ||
130 | * the following partition. When the list is empty, all of | ||
131 | * the nxttail elements point to nxtlist, which is NULL. | ||
132 | * | ||
133 | * [*nxttail[RCU_NEXT_READY_TAIL], NULL = *nxttail[RCU_NEXT_TAIL]): | ||
134 | * Entries that might have arrived after current GP ended | ||
135 | * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]): | ||
136 | * Entries known to have arrived before current GP ended | ||
137 | * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]): | ||
138 | * Entries that batch # <= ->completed - 1: waiting for current GP | ||
139 | * [nxtlist, *nxttail[RCU_DONE_TAIL]): | ||
140 | * Entries that batch # <= ->completed | ||
141 | * The grace period for these entries has completed, and | ||
142 | * the other grace-period-completed entries may be moved | ||
143 | * here temporarily in rcu_process_callbacks(). | ||
144 | */ | ||
145 | struct rcu_head *nxtlist; | ||
146 | struct rcu_head **nxttail[RCU_NEXT_SIZE]; | ||
147 | long qlen; /* # of queued callbacks */ | ||
148 | long blimit; /* Upper limit on a processed batch */ | ||
149 | |||
150 | #ifdef CONFIG_NO_HZ | ||
151 | /* 3) dynticks interface. */ | ||
152 | struct rcu_dynticks *dynticks; /* Shared per-CPU dynticks state. */ | ||
153 | int dynticks_snap; /* Per-GP tracking for dynticks. */ | ||
154 | int dynticks_nmi_snap; /* Per-GP tracking for dynticks_nmi. */ | ||
155 | #endif /* #ifdef CONFIG_NO_HZ */ | ||
156 | |||
157 | /* 4) reasons this CPU needed to be kicked by force_quiescent_state */ | ||
158 | #ifdef CONFIG_NO_HZ | ||
159 | unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */ | ||
160 | #endif /* #ifdef CONFIG_NO_HZ */ | ||
161 | unsigned long offline_fqs; /* Kicked due to being offline. */ | ||
162 | unsigned long resched_ipi; /* Sent a resched IPI. */ | ||
163 | |||
164 | /* 5) __rcu_pending() statistics. */ | ||
165 | long n_rcu_pending; /* rcu_pending() calls since boot. */ | ||
166 | long n_rp_qs_pending; | ||
167 | long n_rp_cb_ready; | ||
168 | long n_rp_cpu_needs_gp; | ||
169 | long n_rp_gp_completed; | ||
170 | long n_rp_gp_started; | ||
171 | long n_rp_need_fqs; | ||
172 | long n_rp_need_nothing; | ||
173 | |||
174 | int cpu; | ||
175 | }; | ||
176 | |||
177 | /* Values for signaled field in struct rcu_state. */ | ||
178 | #define RCU_GP_INIT 0 /* Grace period being initialized. */ | ||
179 | #define RCU_SAVE_DYNTICK 1 /* Need to scan dyntick state. */ | ||
180 | #define RCU_FORCE_QS 2 /* Need to force quiescent state. */ | ||
181 | #ifdef CONFIG_NO_HZ | ||
182 | #define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK | ||
183 | #else /* #ifdef CONFIG_NO_HZ */ | ||
184 | #define RCU_SIGNAL_INIT RCU_FORCE_QS | ||
185 | #endif /* #else #ifdef CONFIG_NO_HZ */ | ||
186 | |||
187 | #define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */ | ||
188 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
189 | #define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rsp->jiffies_stall */ | ||
190 | #define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rsp->jiffies_stall */ | ||
191 | #define RCU_STALL_RAT_DELAY 2 /* Allow other CPUs time */ | ||
192 | /* to take at least one */ | ||
193 | /* scheduling clock irq */ | ||
194 | /* before ratting on them. */ | ||
195 | |||
196 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
197 | |||
198 | /* | ||
199 | * RCU global state, including node hierarchy. This hierarchy is | ||
200 | * represented in "heap" form in a dense array. The root (first level) | ||
201 | * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second | ||
202 | * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]), | ||
203 | * and the third level in ->node[m+1] and following (->node[m+1] referenced | ||
204 | * by ->level[2]). The number of levels is determined by the number of | ||
205 | * CPUs and by CONFIG_RCU_FANOUT. Small systems will have a "hierarchy" | ||
206 | * consisting of a single rcu_node. | ||
207 | */ | ||
208 | struct rcu_state { | ||
209 | struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */ | ||
210 | struct rcu_node *level[NUM_RCU_LVLS]; /* Hierarchy levels. */ | ||
211 | u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */ | ||
212 | u8 levelspread[NUM_RCU_LVLS]; /* kids/node in each level. */ | ||
213 | struct rcu_data *rda[NR_CPUS]; /* array of rdp pointers. */ | ||
214 | |||
215 | /* The following fields are guarded by the root rcu_node's lock. */ | ||
216 | |||
217 | u8 signaled ____cacheline_internodealigned_in_smp; | ||
218 | /* Force QS state. */ | ||
219 | long gpnum; /* Current gp number. */ | ||
220 | long completed; /* # of last completed gp. */ | ||
221 | spinlock_t onofflock; /* exclude on/offline and */ | ||
222 | /* starting new GP. */ | ||
223 | spinlock_t fqslock; /* Only one task forcing */ | ||
224 | /* quiescent states. */ | ||
225 | unsigned long jiffies_force_qs; /* Time at which to invoke */ | ||
226 | /* force_quiescent_state(). */ | ||
227 | unsigned long n_force_qs; /* Number of calls to */ | ||
228 | /* force_quiescent_state(). */ | ||
229 | unsigned long n_force_qs_lh; /* ~Number of calls leaving */ | ||
230 | /* due to lock unavailable. */ | ||
231 | unsigned long n_force_qs_ngp; /* Number of calls leaving */ | ||
232 | /* due to no GP active. */ | ||
233 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
234 | unsigned long gp_start; /* Time at which GP started, */ | ||
235 | /* but in jiffies. */ | ||
236 | unsigned long jiffies_stall; /* Time at which to check */ | ||
237 | /* for CPU stalls. */ | ||
238 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
239 | #ifdef CONFIG_NO_HZ | ||
240 | long dynticks_completed; /* Value of completed @ snap. */ | ||
241 | #endif /* #ifdef CONFIG_NO_HZ */ | ||
242 | }; | ||
243 | |||
244 | extern void rcu_qsctr_inc(int cpu); | 33 | extern void rcu_qsctr_inc(int cpu); |
245 | extern void rcu_bh_qsctr_inc(int cpu); | 34 | extern void rcu_bh_qsctr_inc(int cpu); |
246 | 35 | ||