diff options
Diffstat (limited to 'kernel/rcupreempt.c')
-rw-r--r-- | kernel/rcupreempt.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/kernel/rcupreempt.c b/kernel/rcupreempt.c index 5d59e850fb71..ce97a4df64d3 100644 --- a/kernel/rcupreempt.c +++ b/kernel/rcupreempt.c | |||
@@ -147,7 +147,51 @@ struct rcu_ctrlblk { | |||
147 | wait_queue_head_t sched_wq; /* Place for rcu_sched to sleep. */ | 147 | wait_queue_head_t sched_wq; /* Place for rcu_sched to sleep. */ |
148 | }; | 148 | }; |
149 | 149 | ||
150 | struct rcu_dyntick_sched { | ||
151 | int dynticks; | ||
152 | int dynticks_snap; | ||
153 | int sched_qs; | ||
154 | int sched_qs_snap; | ||
155 | int sched_dynticks_snap; | ||
156 | }; | ||
157 | |||
158 | static DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_dyntick_sched, rcu_dyntick_sched) = { | ||
159 | .dynticks = 1, | ||
160 | }; | ||
161 | |||
162 | void rcu_qsctr_inc(int cpu) | ||
163 | { | ||
164 | struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu); | ||
165 | |||
166 | rdssp->sched_qs++; | ||
167 | } | ||
168 | |||
169 | #ifdef CONFIG_NO_HZ | ||
170 | |||
171 | void rcu_enter_nohz(void) | ||
172 | { | ||
173 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | ||
174 | |||
175 | smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ | ||
176 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | ||
177 | WARN_ON_RATELIMIT(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1, &rs); | ||
178 | } | ||
179 | |||
180 | void rcu_exit_nohz(void) | ||
181 | { | ||
182 | static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); | ||
183 | |||
184 | __get_cpu_var(rcu_dyntick_sched).dynticks++; | ||
185 | smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ | ||
186 | WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), | ||
187 | &rs); | ||
188 | } | ||
189 | |||
190 | #endif /* CONFIG_NO_HZ */ | ||
191 | |||
192 | |||
150 | static DEFINE_PER_CPU(struct rcu_data, rcu_data); | 193 | static DEFINE_PER_CPU(struct rcu_data, rcu_data); |
194 | |||
151 | static struct rcu_ctrlblk rcu_ctrlblk = { | 195 | static struct rcu_ctrlblk rcu_ctrlblk = { |
152 | .fliplock = __SPIN_LOCK_UNLOCKED(rcu_ctrlblk.fliplock), | 196 | .fliplock = __SPIN_LOCK_UNLOCKED(rcu_ctrlblk.fliplock), |
153 | .completed = 0, | 197 | .completed = 0, |
@@ -427,10 +471,6 @@ static void __rcu_advance_callbacks(struct rcu_data *rdp) | |||
427 | } | 471 | } |
428 | } | 472 | } |
429 | 473 | ||
430 | DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_dyntick_sched, rcu_dyntick_sched) = { | ||
431 | .dynticks = 1, | ||
432 | }; | ||
433 | |||
434 | #ifdef CONFIG_NO_HZ | 474 | #ifdef CONFIG_NO_HZ |
435 | static DEFINE_PER_CPU(int, rcu_update_flag); | 475 | static DEFINE_PER_CPU(int, rcu_update_flag); |
436 | 476 | ||