2 * Read-Copy Update mechanism for mutual exclusion, realtime implementation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * Copyright IBM Corporation, 2006
20 * Authors: Paul E. McKenney <paulmck@us.ibm.com>
21 * With thanks to Esben Nielsen, Bill Huey, and Ingo Molnar
22 * for pushing me away from locks and towards counters, and
23 * to Suparna Bhattacharya for pushing me completely away
24 * from atomic instructions on the read side.
26 * - Added handling of Dynamic Ticks
27 * Copyright 2007 - Paul E. Mckenney <paulmck@us.ibm.com>
28 * - Steven Rostedt <srostedt@redhat.com>
30 * Papers: http://www.rdrop.com/users/paulmck/RCU
32 * Design Document: http://lwn.net/Articles/253651/
34 * For detailed explanation of Read-Copy Update mechanism see -
35 * Documentation/RCU/ *.txt
38 #include <linux/types.h>
39 #include <linux/kernel.h>
40 #include <linux/init.h>
41 #include <linux/spinlock.h>
42 #include <linux/smp.h>
43 #include <linux/rcupdate.h>
44 #include <linux/interrupt.h>
45 #include <linux/sched.h>
46 #include <asm/atomic.h>
47 #include <linux/bitops.h>
48 #include <linux/module.h>
49 #include <linux/kthread.h>
50 #include <linux/completion.h>
51 #include <linux/moduleparam.h>
52 #include <linux/percpu.h>
53 #include <linux/notifier.h>
54 #include <linux/cpu.h>
55 #include <linux/random.h>
56 #include <linux/delay.h>
57 #include <linux/cpumask.h>
58 #include <linux/rcupreempt_trace.h>
59 #include <asm/byteorder.h>
62 * PREEMPT_RCU data structures.
66 * GP_STAGES specifies the number of times the state machine has
67 * to go through the all the rcu_try_flip_states (see below)
68 * in a single Grace Period.
70 * GP in GP_STAGES stands for Grace Period ;)
74 spinlock_t lock
; /* Protect rcu_data fields. */
75 long completed
; /* Number of last completed batch. */
77 struct rcu_head
*nextlist
;
78 struct rcu_head
**nexttail
;
79 struct rcu_head
*waitlist
[GP_STAGES
];
80 struct rcu_head
**waittail
[GP_STAGES
];
81 struct rcu_head
*donelist
; /* from waitlist & waitschedlist */
82 struct rcu_head
**donetail
;
84 struct rcu_head
*nextschedlist
;
85 struct rcu_head
**nextschedtail
;
86 struct rcu_head
*waitschedlist
;
87 struct rcu_head
**waitschedtail
;
88 int rcu_sched_sleeping
;
89 #ifdef CONFIG_RCU_TRACE
90 struct rcupreempt_trace trace
;
91 #endif /* #ifdef CONFIG_RCU_TRACE */
95 * States for rcu_try_flip() and friends.
98 enum rcu_try_flip_states
{
101 * Stay here if nothing is happening. Flip the counter if somthing
102 * starts happening. Denoted by "I"
104 rcu_try_flip_idle_state
,
107 * Wait here for all CPUs to notice that the counter has flipped. This
108 * prevents the old set of counters from ever being incremented once
109 * we leave this state, which in turn is necessary because we cannot
110 * test any individual counter for zero -- we can only check the sum.
113 rcu_try_flip_waitack_state
,
116 * Wait here for the sum of the old per-CPU counters to reach zero.
119 rcu_try_flip_waitzero_state
,
122 * Wait here for each of the other CPUs to execute a memory barrier.
123 * This is necessary to ensure that these other CPUs really have
124 * completed executing their RCU read-side critical sections, despite
125 * their CPUs wildly reordering memory. Denoted by "M".
127 rcu_try_flip_waitmb_state
,
131 * States for rcu_ctrlblk.rcu_sched_sleep.
134 enum rcu_sched_sleep_states
{
135 rcu_sched_not_sleeping
, /* Not sleeping, callbacks need GP. */
136 rcu_sched_sleep_prep
, /* Thinking of sleeping, rechecking. */
137 rcu_sched_sleeping
, /* Sleeping, awaken if GP needed. */
141 spinlock_t fliplock
; /* Protect state-machine transitions. */
142 long completed
; /* Number of last completed batch. */
143 enum rcu_try_flip_states rcu_try_flip_state
; /* The current state of
144 the rcu state machine */
145 spinlock_t schedlock
; /* Protect rcu_sched sleep state. */
146 enum rcu_sched_sleep_states sched_sleep
; /* rcu_sched state. */
147 wait_queue_head_t sched_wq
; /* Place for rcu_sched to sleep. */
150 static DEFINE_PER_CPU(struct rcu_data
, rcu_data
);
151 static struct rcu_ctrlblk rcu_ctrlblk
= {
152 .fliplock
= __SPIN_LOCK_UNLOCKED(rcu_ctrlblk
.fliplock
),
154 .rcu_try_flip_state
= rcu_try_flip_idle_state
,
155 .schedlock
= __SPIN_LOCK_UNLOCKED(rcu_ctrlblk
.schedlock
),
156 .sched_sleep
= rcu_sched_not_sleeping
,
157 .sched_wq
= __WAIT_QUEUE_HEAD_INITIALIZER(rcu_ctrlblk
.sched_wq
),
160 static struct task_struct
*rcu_sched_grace_period_task
;
162 #ifdef CONFIG_RCU_TRACE
163 static char *rcu_try_flip_state_names
[] =
164 { "idle", "waitack", "waitzero", "waitmb" };
165 #endif /* #ifdef CONFIG_RCU_TRACE */
167 static cpumask_t rcu_cpu_online_map __read_mostly
= CPU_MASK_NONE
;
170 * Enum and per-CPU flag to determine when each CPU has seen
171 * the most recent counter flip.
174 enum rcu_flip_flag_values
{
175 rcu_flip_seen
, /* Steady/initial state, last flip seen. */
176 /* Only GP detector can update. */
177 rcu_flipped
/* Flip just completed, need confirmation. */
178 /* Only corresponding CPU can update. */
180 static DEFINE_PER_CPU_SHARED_ALIGNED(enum rcu_flip_flag_values
, rcu_flip_flag
)
184 * Enum and per-CPU flag to determine when each CPU has executed the
185 * needed memory barrier to fence in memory references from its last RCU
186 * read-side critical section in the just-completed grace period.
189 enum rcu_mb_flag_values
{
190 rcu_mb_done
, /* Steady/initial state, no mb()s required. */
191 /* Only GP detector can update. */
192 rcu_mb_needed
/* Flip just completed, need an mb(). */
193 /* Only corresponding CPU can update. */
195 static DEFINE_PER_CPU_SHARED_ALIGNED(enum rcu_mb_flag_values
, rcu_mb_flag
)
199 * RCU_DATA_ME: find the current CPU's rcu_data structure.
200 * RCU_DATA_CPU: find the specified CPU's rcu_data structure.
202 #define RCU_DATA_ME() (&__get_cpu_var(rcu_data))
203 #define RCU_DATA_CPU(cpu) (&per_cpu(rcu_data, cpu))
206 * Helper macro for tracing when the appropriate rcu_data is not
207 * cached in a local variable, but where the CPU number is so cached.
209 #define RCU_TRACE_CPU(f, cpu) RCU_TRACE(f, &(RCU_DATA_CPU(cpu)->trace));
212 * Helper macro for tracing when the appropriate rcu_data is not
213 * cached in a local variable.
215 #define RCU_TRACE_ME(f) RCU_TRACE(f, &(RCU_DATA_ME()->trace));
218 * Helper macro for tracing when the appropriate rcu_data is pointed
219 * to by a local variable.
221 #define RCU_TRACE_RDP(f, rdp) RCU_TRACE(f, &((rdp)->trace));
223 #define RCU_SCHED_BATCH_TIME (HZ / 50)
226 * Return the number of RCU batches processed thus far. Useful
227 * for debug and statistics.
229 long rcu_batches_completed(void)
231 return rcu_ctrlblk
.completed
;
233 EXPORT_SYMBOL_GPL(rcu_batches_completed
);
235 void __rcu_read_lock(void)
238 struct task_struct
*t
= current
;
241 nesting
= ACCESS_ONCE(t
->rcu_read_lock_nesting
);
244 /* An earlier rcu_read_lock() covers us, just count it. */
246 t
->rcu_read_lock_nesting
= nesting
+ 1;
252 * We disable interrupts for the following reasons:
253 * - If we get scheduling clock interrupt here, and we
254 * end up acking the counter flip, it's like a promise
255 * that we will never increment the old counter again.
256 * Thus we will break that promise if that
257 * scheduling clock interrupt happens between the time
258 * we pick the .completed field and the time that we
259 * increment our counter.
261 * - We don't want to be preempted out here.
263 * NMIs can still occur, of course, and might themselves
264 * contain rcu_read_lock().
267 local_irq_save(flags
);
270 * Outermost nesting of rcu_read_lock(), so increment
271 * the current counter for the current CPU. Use volatile
272 * casts to prevent the compiler from reordering.
275 idx
= ACCESS_ONCE(rcu_ctrlblk
.completed
) & 0x1;
276 ACCESS_ONCE(RCU_DATA_ME()->rcu_flipctr
[idx
])++;
279 * Now that the per-CPU counter has been incremented, we
280 * are protected from races with rcu_read_lock() invoked
281 * from NMI handlers on this CPU. We can therefore safely
282 * increment the nesting counter, relieving further NMIs
283 * of the need to increment the per-CPU counter.
286 ACCESS_ONCE(t
->rcu_read_lock_nesting
) = nesting
+ 1;
289 * Now that we have preventing any NMIs from storing
290 * to the ->rcu_flipctr_idx, we can safely use it to
291 * remember which counter to decrement in the matching
295 ACCESS_ONCE(t
->rcu_flipctr_idx
) = idx
;
296 local_irq_restore(flags
);
299 EXPORT_SYMBOL_GPL(__rcu_read_lock
);
301 void __rcu_read_unlock(void)
304 struct task_struct
*t
= current
;
307 nesting
= ACCESS_ONCE(t
->rcu_read_lock_nesting
);
311 * We are still protected by the enclosing rcu_read_lock(),
312 * so simply decrement the counter.
315 t
->rcu_read_lock_nesting
= nesting
- 1;
321 * Disable local interrupts to prevent the grace-period
322 * detection state machine from seeing us half-done.
323 * NMIs can still occur, of course, and might themselves
324 * contain rcu_read_lock() and rcu_read_unlock().
327 local_irq_save(flags
);
330 * Outermost nesting of rcu_read_unlock(), so we must
331 * decrement the current counter for the current CPU.
332 * This must be done carefully, because NMIs can
333 * occur at any point in this code, and any rcu_read_lock()
334 * and rcu_read_unlock() pairs in the NMI handlers
335 * must interact non-destructively with this code.
336 * Lots of volatile casts, and -very- careful ordering.
338 * Changes to this code, including this one, must be
339 * inspected, validated, and tested extremely carefully!!!
343 * First, pick up the index.
346 idx
= ACCESS_ONCE(t
->rcu_flipctr_idx
);
349 * Now that we have fetched the counter index, it is
350 * safe to decrement the per-task RCU nesting counter.
351 * After this, any interrupts or NMIs will increment and
352 * decrement the per-CPU counters.
354 ACCESS_ONCE(t
->rcu_read_lock_nesting
) = nesting
- 1;
357 * It is now safe to decrement this task's nesting count.
358 * NMIs that occur after this statement will route their
359 * rcu_read_lock() calls through this "else" clause, and
360 * will thus start incrementing the per-CPU counter on
361 * their own. They will also clobber ->rcu_flipctr_idx,
362 * but that is OK, since we have already fetched it.
365 ACCESS_ONCE(RCU_DATA_ME()->rcu_flipctr
[idx
])--;
366 local_irq_restore(flags
);
369 EXPORT_SYMBOL_GPL(__rcu_read_unlock
);
372 * If a global counter flip has occurred since the last time that we
373 * advanced callbacks, advance them. Hardware interrupts must be
374 * disabled when calling this function.
376 static void __rcu_advance_callbacks(struct rcu_data
*rdp
)
382 if (rdp
->completed
!= rcu_ctrlblk
.completed
) {
383 if (rdp
->waitlist
[GP_STAGES
- 1] != NULL
) {
384 *rdp
->donetail
= rdp
->waitlist
[GP_STAGES
- 1];
385 rdp
->donetail
= rdp
->waittail
[GP_STAGES
- 1];
386 RCU_TRACE_RDP(rcupreempt_trace_move2done
, rdp
);
388 for (i
= GP_STAGES
- 2; i
>= 0; i
--) {
389 if (rdp
->waitlist
[i
] != NULL
) {
390 rdp
->waitlist
[i
+ 1] = rdp
->waitlist
[i
];
391 rdp
->waittail
[i
+ 1] = rdp
->waittail
[i
];
394 rdp
->waitlist
[i
+ 1] = NULL
;
395 rdp
->waittail
[i
+ 1] =
396 &rdp
->waitlist
[i
+ 1];
399 if (rdp
->nextlist
!= NULL
) {
400 rdp
->waitlist
[0] = rdp
->nextlist
;
401 rdp
->waittail
[0] = rdp
->nexttail
;
403 rdp
->nextlist
= NULL
;
404 rdp
->nexttail
= &rdp
->nextlist
;
405 RCU_TRACE_RDP(rcupreempt_trace_move2wait
, rdp
);
407 rdp
->waitlist
[0] = NULL
;
408 rdp
->waittail
[0] = &rdp
->waitlist
[0];
410 rdp
->waitlistcount
= wlc
;
411 rdp
->completed
= rcu_ctrlblk
.completed
;
415 * Check to see if this CPU needs to report that it has seen
416 * the most recent counter flip, thereby declaring that all
417 * subsequent rcu_read_lock() invocations will respect this flip.
420 cpu
= raw_smp_processor_id();
421 if (per_cpu(rcu_flip_flag
, cpu
) == rcu_flipped
) {
422 smp_mb(); /* Subsequent counter accesses must see new value */
423 per_cpu(rcu_flip_flag
, cpu
) = rcu_flip_seen
;
424 smp_mb(); /* Subsequent RCU read-side critical sections */
425 /* seen -after- acknowledgement. */
429 DEFINE_PER_CPU_SHARED_ALIGNED(struct rcu_dyntick_sched
, rcu_dyntick_sched
) = {
434 static DEFINE_PER_CPU(int, rcu_update_flag
);
437 * rcu_irq_enter - Called from Hard irq handlers and NMI/SMI.
439 * If the CPU was idle with dynamic ticks active, this updates the
440 * rcu_dyntick_sched.dynticks to let the RCU handling know that the
443 void rcu_irq_enter(void)
445 int cpu
= smp_processor_id();
446 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
448 if (per_cpu(rcu_update_flag
, cpu
))
449 per_cpu(rcu_update_flag
, cpu
)++;
452 * Only update if we are coming from a stopped ticks mode
453 * (rcu_dyntick_sched.dynticks is even).
455 if (!in_interrupt() &&
456 (rdssp
->dynticks
& 0x1) == 0) {
458 * The following might seem like we could have a race
459 * with NMI/SMIs. But this really isn't a problem.
460 * Here we do a read/modify/write, and the race happens
461 * when an NMI/SMI comes in after the read and before
462 * the write. But NMI/SMIs will increment this counter
463 * twice before returning, so the zero bit will not
464 * be corrupted by the NMI/SMI which is the most important
467 * The only thing is that we would bring back the counter
468 * to a postion that it was in during the NMI/SMI.
469 * But the zero bit would be set, so the rest of the
470 * counter would again be ignored.
472 * On return from the IRQ, the counter may have the zero
473 * bit be 0 and the counter the same as the return from
474 * the NMI/SMI. If the state machine was so unlucky to
475 * see that, it still doesn't matter, since all
476 * RCU read-side critical sections on this CPU would
477 * have already completed.
481 * The following memory barrier ensures that any
482 * rcu_read_lock() primitives in the irq handler
483 * are seen by other CPUs to follow the above
484 * increment to rcu_dyntick_sched.dynticks. This is
485 * required in order for other CPUs to correctly
486 * determine when it is safe to advance the RCU
487 * grace-period state machine.
489 smp_mb(); /* see above block comment. */
491 * Since we can't determine the dynamic tick mode from
492 * the rcu_dyntick_sched.dynticks after this routine,
493 * we use a second flag to acknowledge that we came
494 * from an idle state with ticks stopped.
496 per_cpu(rcu_update_flag
, cpu
)++;
498 * If we take an NMI/SMI now, they will also increment
499 * the rcu_update_flag, and will not update the
500 * rcu_dyntick_sched.dynticks on exit. That is for
507 * rcu_irq_exit - Called from exiting Hard irq context.
509 * If the CPU was idle with dynamic ticks active, update the
510 * rcu_dyntick_sched.dynticks to put let the RCU handling be
511 * aware that the CPU is going back to idle with no ticks.
513 void rcu_irq_exit(void)
515 int cpu
= smp_processor_id();
516 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
519 * rcu_update_flag is set if we interrupted the CPU
520 * when it was idle with ticks stopped.
521 * Once this occurs, we keep track of interrupt nesting
522 * because a NMI/SMI could also come in, and we still
523 * only want the IRQ that started the increment of the
524 * rcu_dyntick_sched.dynticks to be the one that modifies
527 if (per_cpu(rcu_update_flag
, cpu
)) {
528 if (--per_cpu(rcu_update_flag
, cpu
))
531 /* This must match the interrupt nesting */
532 WARN_ON(in_interrupt());
535 * If an NMI/SMI happens now we are still
536 * protected by the rcu_dyntick_sched.dynticks being odd.
540 * The following memory barrier ensures that any
541 * rcu_read_unlock() primitives in the irq handler
542 * are seen by other CPUs to preceed the following
543 * increment to rcu_dyntick_sched.dynticks. This
544 * is required in order for other CPUs to determine
545 * when it is safe to advance the RCU grace-period
548 smp_mb(); /* see above block comment. */
550 WARN_ON(rdssp
->dynticks
& 0x1);
554 void rcu_nmi_enter(void)
559 void rcu_nmi_exit(void)
564 static void dyntick_save_progress_counter(int cpu
)
566 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
568 rdssp
->dynticks_snap
= rdssp
->dynticks
;
572 rcu_try_flip_waitack_needed(int cpu
)
576 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
578 curr
= rdssp
->dynticks
;
579 snap
= rdssp
->dynticks_snap
;
580 smp_mb(); /* force ordering with cpu entering/leaving dynticks. */
583 * If the CPU remained in dynticks mode for the entire time
584 * and didn't take any interrupts, NMIs, SMIs, or whatever,
585 * then it cannot be in the middle of an rcu_read_lock(), so
586 * the next rcu_read_lock() it executes must use the new value
587 * of the counter. So we can safely pretend that this CPU
588 * already acknowledged the counter.
591 if ((curr
== snap
) && ((curr
& 0x1) == 0))
595 * If the CPU passed through or entered a dynticks idle phase with
596 * no active irq handlers, then, as above, we can safely pretend
597 * that this CPU already acknowledged the counter.
600 if ((curr
- snap
) > 2 || (curr
& 0x1) == 0)
603 /* We need this CPU to explicitly acknowledge the counter flip. */
609 rcu_try_flip_waitmb_needed(int cpu
)
613 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
615 curr
= rdssp
->dynticks
;
616 snap
= rdssp
->dynticks_snap
;
617 smp_mb(); /* force ordering with cpu entering/leaving dynticks. */
620 * If the CPU remained in dynticks mode for the entire time
621 * and didn't take any interrupts, NMIs, SMIs, or whatever,
622 * then it cannot have executed an RCU read-side critical section
623 * during that time, so there is no need for it to execute a
627 if ((curr
== snap
) && ((curr
& 0x1) == 0))
631 * If the CPU either entered or exited an outermost interrupt,
632 * SMI, NMI, or whatever handler, then we know that it executed
633 * a memory barrier when doing so. So we don't need another one.
638 /* We need the CPU to execute a memory barrier. */
643 static void dyntick_save_progress_counter_sched(int cpu
)
645 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
647 rdssp
->sched_dynticks_snap
= rdssp
->dynticks
;
650 static int rcu_qsctr_inc_needed_dyntick(int cpu
)
654 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
656 curr
= rdssp
->dynticks
;
657 snap
= rdssp
->sched_dynticks_snap
;
658 smp_mb(); /* force ordering with cpu entering/leaving dynticks. */
661 * If the CPU remained in dynticks mode for the entire time
662 * and didn't take any interrupts, NMIs, SMIs, or whatever,
663 * then it cannot be in the middle of an rcu_read_lock(), so
664 * the next rcu_read_lock() it executes must use the new value
665 * of the counter. Therefore, this CPU has been in a quiescent
666 * state the entire time, and we don't need to wait for it.
669 if ((curr
== snap
) && ((curr
& 0x1) == 0))
673 * If the CPU passed through or entered a dynticks idle phase with
674 * no active irq handlers, then, as above, this CPU has already
675 * passed through a quiescent state.
678 if ((curr
- snap
) > 2 || (snap
& 0x1) == 0)
681 /* We need this CPU to go through a quiescent state. */
686 #else /* !CONFIG_NO_HZ */
688 # define dyntick_save_progress_counter(cpu) do { } while (0)
689 # define rcu_try_flip_waitack_needed(cpu) (1)
690 # define rcu_try_flip_waitmb_needed(cpu) (1)
692 # define dyntick_save_progress_counter_sched(cpu) do { } while (0)
693 # define rcu_qsctr_inc_needed_dyntick(cpu) (1)
695 #endif /* CONFIG_NO_HZ */
697 static void save_qsctr_sched(int cpu
)
699 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
701 rdssp
->sched_qs_snap
= rdssp
->sched_qs
;
704 static inline int rcu_qsctr_inc_needed(int cpu
)
706 struct rcu_dyntick_sched
*rdssp
= &per_cpu(rcu_dyntick_sched
, cpu
);
709 * If there has been a quiescent state, no more need to wait
713 if (rdssp
->sched_qs
!= rdssp
->sched_qs_snap
) {
714 smp_mb(); /* force ordering with cpu entering schedule(). */
718 /* We need this CPU to go through a quiescent state. */
724 * Get here when RCU is idle. Decide whether we need to
725 * move out of idle state, and return non-zero if so.
726 * "Straightforward" approach for the moment, might later
727 * use callback-list lengths, grace-period duration, or
728 * some such to determine when to exit idle state.
729 * Might also need a pre-idle test that does not acquire
730 * the lock, but let's get the simple case working first...
734 rcu_try_flip_idle(void)
738 RCU_TRACE_ME(rcupreempt_trace_try_flip_i1
);
739 if (!rcu_pending(smp_processor_id())) {
740 RCU_TRACE_ME(rcupreempt_trace_try_flip_ie1
);
748 RCU_TRACE_ME(rcupreempt_trace_try_flip_g1
);
749 rcu_ctrlblk
.completed
++; /* stands in for rcu_try_flip_g2 */
752 * Need a memory barrier so that other CPUs see the new
753 * counter value before they see the subsequent change of all
754 * the rcu_flip_flag instances to rcu_flipped.
757 smp_mb(); /* see above block comment. */
759 /* Now ask each CPU for acknowledgement of the flip. */
761 for_each_cpu_mask_nr(cpu
, rcu_cpu_online_map
) {
762 per_cpu(rcu_flip_flag
, cpu
) = rcu_flipped
;
763 dyntick_save_progress_counter(cpu
);
770 * Wait for CPUs to acknowledge the flip.
774 rcu_try_flip_waitack(void)
778 RCU_TRACE_ME(rcupreempt_trace_try_flip_a1
);
779 for_each_cpu_mask_nr(cpu
, rcu_cpu_online_map
)
780 if (rcu_try_flip_waitack_needed(cpu
) &&
781 per_cpu(rcu_flip_flag
, cpu
) != rcu_flip_seen
) {
782 RCU_TRACE_ME(rcupreempt_trace_try_flip_ae1
);
787 * Make sure our checks above don't bleed into subsequent
788 * waiting for the sum of the counters to reach zero.
791 smp_mb(); /* see above block comment. */
792 RCU_TRACE_ME(rcupreempt_trace_try_flip_a2
);
797 * Wait for collective ``last'' counter to reach zero,
798 * then tell all CPUs to do an end-of-grace-period memory barrier.
802 rcu_try_flip_waitzero(void)
805 int lastidx
= !(rcu_ctrlblk
.completed
& 0x1);
808 /* Check to see if the sum of the "last" counters is zero. */
810 RCU_TRACE_ME(rcupreempt_trace_try_flip_z1
);
811 for_each_cpu_mask_nr(cpu
, rcu_cpu_online_map
)
812 sum
+= RCU_DATA_CPU(cpu
)->rcu_flipctr
[lastidx
];
814 RCU_TRACE_ME(rcupreempt_trace_try_flip_ze1
);
819 * This ensures that the other CPUs see the call for
820 * memory barriers -after- the sum to zero has been
823 smp_mb(); /* ^^^^^^^^^^^^ */
825 /* Call for a memory barrier from each CPU. */
826 for_each_cpu_mask_nr(cpu
, rcu_cpu_online_map
) {
827 per_cpu(rcu_mb_flag
, cpu
) = rcu_mb_needed
;
828 dyntick_save_progress_counter(cpu
);
831 RCU_TRACE_ME(rcupreempt_trace_try_flip_z2
);
836 * Wait for all CPUs to do their end-of-grace-period memory barrier.
837 * Return 0 once all CPUs have done so.
841 rcu_try_flip_waitmb(void)
845 RCU_TRACE_ME(rcupreempt_trace_try_flip_m1
);
846 for_each_cpu_mask_nr(cpu
, rcu_cpu_online_map
)
847 if (rcu_try_flip_waitmb_needed(cpu
) &&
848 per_cpu(rcu_mb_flag
, cpu
) != rcu_mb_done
) {
849 RCU_TRACE_ME(rcupreempt_trace_try_flip_me1
);
853 smp_mb(); /* Ensure that the above checks precede any following flip. */
854 RCU_TRACE_ME(rcupreempt_trace_try_flip_m2
);
859 * Attempt a single flip of the counters. Remember, a single flip does
860 * -not- constitute a grace period. Instead, the interval between
861 * at least GP_STAGES consecutive flips is a grace period.
863 * If anyone is nuts enough to run this CONFIG_PREEMPT_RCU implementation
864 * on a large SMP, they might want to use a hierarchical organization of
865 * the per-CPU-counter pairs.
867 static void rcu_try_flip(void)
871 RCU_TRACE_ME(rcupreempt_trace_try_flip_1
);
872 if (unlikely(!spin_trylock_irqsave(&rcu_ctrlblk
.fliplock
, flags
))) {
873 RCU_TRACE_ME(rcupreempt_trace_try_flip_e1
);
878 * Take the next transition(s) through the RCU grace-period
879 * flip-counter state machine.
882 switch (rcu_ctrlblk
.rcu_try_flip_state
) {
883 case rcu_try_flip_idle_state
:
884 if (rcu_try_flip_idle())
885 rcu_ctrlblk
.rcu_try_flip_state
=
886 rcu_try_flip_waitack_state
;
888 case rcu_try_flip_waitack_state
:
889 if (rcu_try_flip_waitack())
890 rcu_ctrlblk
.rcu_try_flip_state
=
891 rcu_try_flip_waitzero_state
;
893 case rcu_try_flip_waitzero_state
:
894 if (rcu_try_flip_waitzero())
895 rcu_ctrlblk
.rcu_try_flip_state
=
896 rcu_try_flip_waitmb_state
;
898 case rcu_try_flip_waitmb_state
:
899 if (rcu_try_flip_waitmb())
900 rcu_ctrlblk
.rcu_try_flip_state
=
901 rcu_try_flip_idle_state
;
903 spin_unlock_irqrestore(&rcu_ctrlblk
.fliplock
, flags
);
907 * Check to see if this CPU needs to do a memory barrier in order to
908 * ensure that any prior RCU read-side critical sections have committed
909 * their counter manipulations and critical-section memory references
910 * before declaring the grace period to be completed.
912 static void rcu_check_mb(int cpu
)
914 if (per_cpu(rcu_mb_flag
, cpu
) == rcu_mb_needed
) {
915 smp_mb(); /* Ensure RCU read-side accesses are visible. */
916 per_cpu(rcu_mb_flag
, cpu
) = rcu_mb_done
;
920 void rcu_check_callbacks(int cpu
, int user
)
923 struct rcu_data
*rdp
= RCU_DATA_CPU(cpu
);
926 * If this CPU took its interrupt from user mode or from the
927 * idle loop, and this is not a nested interrupt, then
928 * this CPU has to have exited all prior preept-disable
929 * sections of code. So increment the counter to note this.
931 * The memory barrier is needed to handle the case where
932 * writes from a preempt-disable section of code get reordered
933 * into schedule() by this CPU's write buffer. So the memory
934 * barrier makes sure that the rcu_qsctr_inc() is seen by other
935 * CPUs to happen after any such write.
939 (idle_cpu(cpu
) && !in_softirq() &&
940 hardirq_count() <= (1 << HARDIRQ_SHIFT
))) {
941 smp_mb(); /* Guard against aggressive schedule(). */
946 if (rcu_ctrlblk
.completed
== rdp
->completed
)
948 spin_lock_irqsave(&rdp
->lock
, flags
);
949 RCU_TRACE_RDP(rcupreempt_trace_check_callbacks
, rdp
);
950 __rcu_advance_callbacks(rdp
);
951 if (rdp
->donelist
== NULL
) {
952 spin_unlock_irqrestore(&rdp
->lock
, flags
);
954 spin_unlock_irqrestore(&rdp
->lock
, flags
);
955 raise_softirq(RCU_SOFTIRQ
);
960 * Needed by dynticks, to make sure all RCU processing has finished
963 void rcu_advance_callbacks(int cpu
, int user
)
966 struct rcu_data
*rdp
= RCU_DATA_CPU(cpu
);
968 if (rcu_ctrlblk
.completed
== rdp
->completed
) {
970 if (rcu_ctrlblk
.completed
== rdp
->completed
)
973 spin_lock_irqsave(&rdp
->lock
, flags
);
974 RCU_TRACE_RDP(rcupreempt_trace_check_callbacks
, rdp
);
975 __rcu_advance_callbacks(rdp
);
976 spin_unlock_irqrestore(&rdp
->lock
, flags
);
979 #ifdef CONFIG_HOTPLUG_CPU
980 #define rcu_offline_cpu_enqueue(srclist, srctail, dstlist, dsttail) do { \
981 *dsttail = srclist; \
982 if (srclist != NULL) { \
989 void rcu_offline_cpu(int cpu
)
992 struct rcu_head
*list
= NULL
;
994 struct rcu_data
*rdp
= RCU_DATA_CPU(cpu
);
995 struct rcu_head
*schedlist
= NULL
;
996 struct rcu_head
**schedtail
= &schedlist
;
997 struct rcu_head
**tail
= &list
;
1000 * Remove all callbacks from the newly dead CPU, retaining order.
1001 * Otherwise rcu_barrier() will fail
1004 spin_lock_irqsave(&rdp
->lock
, flags
);
1005 rcu_offline_cpu_enqueue(rdp
->donelist
, rdp
->donetail
, list
, tail
);
1006 for (i
= GP_STAGES
- 1; i
>= 0; i
--)
1007 rcu_offline_cpu_enqueue(rdp
->waitlist
[i
], rdp
->waittail
[i
],
1009 rcu_offline_cpu_enqueue(rdp
->nextlist
, rdp
->nexttail
, list
, tail
);
1010 rcu_offline_cpu_enqueue(rdp
->waitschedlist
, rdp
->waitschedtail
,
1011 schedlist
, schedtail
);
1012 rcu_offline_cpu_enqueue(rdp
->nextschedlist
, rdp
->nextschedtail
,
1013 schedlist
, schedtail
);
1014 rdp
->rcu_sched_sleeping
= 0;
1015 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1016 rdp
->waitlistcount
= 0;
1018 /* Disengage the newly dead CPU from the grace-period computation. */
1020 spin_lock_irqsave(&rcu_ctrlblk
.fliplock
, flags
);
1022 if (per_cpu(rcu_flip_flag
, cpu
) == rcu_flipped
) {
1023 smp_mb(); /* Subsequent counter accesses must see new value */
1024 per_cpu(rcu_flip_flag
, cpu
) = rcu_flip_seen
;
1025 smp_mb(); /* Subsequent RCU read-side critical sections */
1026 /* seen -after- acknowledgement. */
1029 RCU_DATA_ME()->rcu_flipctr
[0] += RCU_DATA_CPU(cpu
)->rcu_flipctr
[0];
1030 RCU_DATA_ME()->rcu_flipctr
[1] += RCU_DATA_CPU(cpu
)->rcu_flipctr
[1];
1032 RCU_DATA_CPU(cpu
)->rcu_flipctr
[0] = 0;
1033 RCU_DATA_CPU(cpu
)->rcu_flipctr
[1] = 0;
1035 cpu_clear(cpu
, rcu_cpu_online_map
);
1037 spin_unlock_irqrestore(&rcu_ctrlblk
.fliplock
, flags
);
1040 * Place the removed callbacks on the current CPU's queue.
1041 * Make them all start a new grace period: simple approach,
1042 * in theory could starve a given set of callbacks, but
1043 * you would need to be doing some serious CPU hotplugging
1044 * to make this happen. If this becomes a problem, adding
1045 * a synchronize_rcu() to the hotplug path would be a simple
1049 local_irq_save(flags
); /* disable preempt till we know what lock. */
1050 rdp
= RCU_DATA_ME();
1051 spin_lock(&rdp
->lock
);
1052 *rdp
->nexttail
= list
;
1054 rdp
->nexttail
= tail
;
1055 *rdp
->nextschedtail
= schedlist
;
1057 rdp
->nextschedtail
= schedtail
;
1058 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1061 #else /* #ifdef CONFIG_HOTPLUG_CPU */
1063 void rcu_offline_cpu(int cpu
)
1067 #endif /* #else #ifdef CONFIG_HOTPLUG_CPU */
1069 void __cpuinit
rcu_online_cpu(int cpu
)
1071 unsigned long flags
;
1072 struct rcu_data
*rdp
;
1074 spin_lock_irqsave(&rcu_ctrlblk
.fliplock
, flags
);
1075 cpu_set(cpu
, rcu_cpu_online_map
);
1076 spin_unlock_irqrestore(&rcu_ctrlblk
.fliplock
, flags
);
1079 * The rcu_sched grace-period processing might have bypassed
1080 * this CPU, given that it was not in the rcu_cpu_online_map
1081 * when the grace-period scan started. This means that the
1082 * grace-period task might sleep. So make sure that if this
1083 * should happen, the first callback posted to this CPU will
1084 * wake up the grace-period task if need be.
1087 rdp
= RCU_DATA_CPU(cpu
);
1088 spin_lock_irqsave(&rdp
->lock
, flags
);
1089 rdp
->rcu_sched_sleeping
= 1;
1090 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1093 static void rcu_process_callbacks(struct softirq_action
*unused
)
1095 unsigned long flags
;
1096 struct rcu_head
*next
, *list
;
1097 struct rcu_data
*rdp
;
1099 local_irq_save(flags
);
1100 rdp
= RCU_DATA_ME();
1101 spin_lock(&rdp
->lock
);
1102 list
= rdp
->donelist
;
1104 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1107 rdp
->donelist
= NULL
;
1108 rdp
->donetail
= &rdp
->donelist
;
1109 RCU_TRACE_RDP(rcupreempt_trace_done_remove
, rdp
);
1110 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1115 RCU_TRACE_ME(rcupreempt_trace_invoke
);
1119 void call_rcu(struct rcu_head
*head
, void (*func
)(struct rcu_head
*rcu
))
1121 unsigned long flags
;
1122 struct rcu_data
*rdp
;
1126 local_irq_save(flags
);
1127 rdp
= RCU_DATA_ME();
1128 spin_lock(&rdp
->lock
);
1129 __rcu_advance_callbacks(rdp
);
1130 *rdp
->nexttail
= head
;
1131 rdp
->nexttail
= &head
->next
;
1132 RCU_TRACE_RDP(rcupreempt_trace_next_add
, rdp
);
1133 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1135 EXPORT_SYMBOL_GPL(call_rcu
);
1137 void call_rcu_sched(struct rcu_head
*head
, void (*func
)(struct rcu_head
*rcu
))
1139 unsigned long flags
;
1140 struct rcu_data
*rdp
;
1145 local_irq_save(flags
);
1146 rdp
= RCU_DATA_ME();
1147 spin_lock(&rdp
->lock
);
1148 *rdp
->nextschedtail
= head
;
1149 rdp
->nextschedtail
= &head
->next
;
1150 if (rdp
->rcu_sched_sleeping
) {
1152 /* Grace-period processing might be sleeping... */
1154 rdp
->rcu_sched_sleeping
= 0;
1157 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1160 /* Wake up grace-period processing, unless someone beat us. */
1162 spin_lock_irqsave(&rcu_ctrlblk
.schedlock
, flags
);
1163 if (rcu_ctrlblk
.sched_sleep
!= rcu_sched_sleeping
)
1165 rcu_ctrlblk
.sched_sleep
= rcu_sched_not_sleeping
;
1166 spin_unlock_irqrestore(&rcu_ctrlblk
.schedlock
, flags
);
1168 wake_up_interruptible(&rcu_ctrlblk
.sched_wq
);
1171 EXPORT_SYMBOL_GPL(call_rcu_sched
);
1174 * Wait until all currently running preempt_disable() code segments
1175 * (including hardware-irq-disable segments) complete. Note that
1176 * in -rt this does -not- necessarily result in all currently executing
1177 * interrupt -handlers- having completed.
1179 synchronize_rcu_xxx(__synchronize_sched
, call_rcu_sched
)
1180 EXPORT_SYMBOL_GPL(__synchronize_sched
);
1183 * kthread function that manages call_rcu_sched grace periods.
1185 static int rcu_sched_grace_period(void *arg
)
1187 int couldsleep
; /* might sleep after current pass. */
1188 int couldsleepnext
= 0; /* might sleep after next pass. */
1190 unsigned long flags
;
1191 struct rcu_data
*rdp
;
1195 * Each pass through the following loop handles one
1196 * rcu_sched grace period cycle.
1199 /* Save each CPU's current state. */
1201 for_each_online_cpu(cpu
) {
1202 dyntick_save_progress_counter_sched(cpu
);
1203 save_qsctr_sched(cpu
);
1207 * Sleep for about an RCU grace-period's worth to
1208 * allow better batching and to consume less CPU.
1210 schedule_timeout_interruptible(RCU_SCHED_BATCH_TIME
);
1213 * If there was nothing to do last time, prepare to
1214 * sleep at the end of the current grace period cycle.
1216 couldsleep
= couldsleepnext
;
1219 spin_lock_irqsave(&rcu_ctrlblk
.schedlock
, flags
);
1220 rcu_ctrlblk
.sched_sleep
= rcu_sched_sleep_prep
;
1221 spin_unlock_irqrestore(&rcu_ctrlblk
.schedlock
, flags
);
1225 * Wait on each CPU in turn to have either visited
1226 * a quiescent state or been in dynticks-idle mode.
1228 for_each_online_cpu(cpu
) {
1229 while (rcu_qsctr_inc_needed(cpu
) &&
1230 rcu_qsctr_inc_needed_dyntick(cpu
)) {
1231 /* resched_cpu(cpu); @@@ */
1232 schedule_timeout_interruptible(1);
1236 /* Advance callbacks for each CPU. */
1238 for_each_online_cpu(cpu
) {
1240 rdp
= RCU_DATA_CPU(cpu
);
1241 spin_lock_irqsave(&rdp
->lock
, flags
);
1244 * We are running on this CPU irq-disabled, so no
1245 * CPU can go offline until we re-enable irqs.
1246 * The current CPU might have already gone
1247 * offline (between the for_each_offline_cpu and
1248 * the spin_lock_irqsave), but in that case all its
1249 * callback lists will be empty, so no harm done.
1251 * Advance the callbacks! We share normal RCU's
1252 * donelist, since callbacks are invoked the
1253 * same way in either case.
1255 if (rdp
->waitschedlist
!= NULL
) {
1256 *rdp
->donetail
= rdp
->waitschedlist
;
1257 rdp
->donetail
= rdp
->waitschedtail
;
1260 * Next rcu_check_callbacks() will
1261 * do the required raise_softirq().
1264 if (rdp
->nextschedlist
!= NULL
) {
1265 rdp
->waitschedlist
= rdp
->nextschedlist
;
1266 rdp
->waitschedtail
= rdp
->nextschedtail
;
1270 rdp
->waitschedlist
= NULL
;
1271 rdp
->waitschedtail
= &rdp
->waitschedlist
;
1273 rdp
->nextschedlist
= NULL
;
1274 rdp
->nextschedtail
= &rdp
->nextschedlist
;
1276 /* Mark sleep intention. */
1278 rdp
->rcu_sched_sleeping
= couldsleep
;
1280 spin_unlock_irqrestore(&rdp
->lock
, flags
);
1283 /* If we saw callbacks on the last scan, go deal with them. */
1288 /* Attempt to block... */
1290 spin_lock_irqsave(&rcu_ctrlblk
.schedlock
, flags
);
1291 if (rcu_ctrlblk
.sched_sleep
!= rcu_sched_sleep_prep
) {
1294 * Someone posted a callback after we scanned.
1295 * Go take care of it.
1297 spin_unlock_irqrestore(&rcu_ctrlblk
.schedlock
, flags
);
1302 /* Block until the next person posts a callback. */
1304 rcu_ctrlblk
.sched_sleep
= rcu_sched_sleeping
;
1305 spin_unlock_irqrestore(&rcu_ctrlblk
.schedlock
, flags
);
1307 __wait_event_interruptible(rcu_ctrlblk
.sched_wq
,
1308 rcu_ctrlblk
.sched_sleep
!= rcu_sched_sleeping
,
1312 * Signals would prevent us from sleeping, and we cannot
1313 * do much with them in any case. So flush them.
1316 flush_signals(current
);
1319 } while (!kthread_should_stop());
1325 * Check to see if any future RCU-related work will need to be done
1326 * by the current CPU, even if none need be done immediately, returning
1327 * 1 if so. Assumes that notifiers would take care of handling any
1328 * outstanding requests from the RCU core.
1330 * This function is part of the RCU implementation; it is -not-
1331 * an exported member of the RCU API.
1333 int rcu_needs_cpu(int cpu
)
1335 struct rcu_data
*rdp
= RCU_DATA_CPU(cpu
);
1337 return (rdp
->donelist
!= NULL
||
1338 !!rdp
->waitlistcount
||
1339 rdp
->nextlist
!= NULL
||
1340 rdp
->nextschedlist
!= NULL
||
1341 rdp
->waitschedlist
!= NULL
);
1344 int rcu_pending(int cpu
)
1346 struct rcu_data
*rdp
= RCU_DATA_CPU(cpu
);
1348 /* The CPU has at least one callback queued somewhere. */
1350 if (rdp
->donelist
!= NULL
||
1351 !!rdp
->waitlistcount
||
1352 rdp
->nextlist
!= NULL
||
1353 rdp
->nextschedlist
!= NULL
||
1354 rdp
->waitschedlist
!= NULL
)
1357 /* The RCU core needs an acknowledgement from this CPU. */
1359 if ((per_cpu(rcu_flip_flag
, cpu
) == rcu_flipped
) ||
1360 (per_cpu(rcu_mb_flag
, cpu
) == rcu_mb_needed
))
1363 /* This CPU has fallen behind the global grace-period number. */
1365 if (rdp
->completed
!= rcu_ctrlblk
.completed
)
1368 /* Nothing needed from this CPU. */
1373 static int __cpuinit
rcu_cpu_notify(struct notifier_block
*self
,
1374 unsigned long action
, void *hcpu
)
1376 long cpu
= (long)hcpu
;
1379 case CPU_UP_PREPARE
:
1380 case CPU_UP_PREPARE_FROZEN
:
1381 rcu_online_cpu(cpu
);
1383 case CPU_UP_CANCELED
:
1384 case CPU_UP_CANCELED_FROZEN
:
1386 case CPU_DEAD_FROZEN
:
1387 rcu_offline_cpu(cpu
);
1395 static struct notifier_block __cpuinitdata rcu_nb
= {
1396 .notifier_call
= rcu_cpu_notify
,
1399 void __init
__rcu_init(void)
1403 struct rcu_data
*rdp
;
1405 printk(KERN_NOTICE
"Preemptible RCU implementation.\n");
1406 for_each_possible_cpu(cpu
) {
1407 rdp
= RCU_DATA_CPU(cpu
);
1408 spin_lock_init(&rdp
->lock
);
1410 rdp
->waitlistcount
= 0;
1411 rdp
->nextlist
= NULL
;
1412 rdp
->nexttail
= &rdp
->nextlist
;
1413 for (i
= 0; i
< GP_STAGES
; i
++) {
1414 rdp
->waitlist
[i
] = NULL
;
1415 rdp
->waittail
[i
] = &rdp
->waitlist
[i
];
1417 rdp
->donelist
= NULL
;
1418 rdp
->donetail
= &rdp
->donelist
;
1419 rdp
->rcu_flipctr
[0] = 0;
1420 rdp
->rcu_flipctr
[1] = 0;
1421 rdp
->nextschedlist
= NULL
;
1422 rdp
->nextschedtail
= &rdp
->nextschedlist
;
1423 rdp
->waitschedlist
= NULL
;
1424 rdp
->waitschedtail
= &rdp
->waitschedlist
;
1425 rdp
->rcu_sched_sleeping
= 0;
1427 register_cpu_notifier(&rcu_nb
);
1430 * We don't need protection against CPU-Hotplug here
1432 * a) If a CPU comes online while we are iterating over the
1433 * cpu_online_map below, we would only end up making a
1434 * duplicate call to rcu_online_cpu() which sets the corresponding
1435 * CPU's mask in the rcu_cpu_online_map.
1437 * b) A CPU cannot go offline at this point in time since the user
1438 * does not have access to the sysfs interface, nor do we
1439 * suspend the system.
1441 for_each_online_cpu(cpu
)
1442 rcu_cpu_notify(&rcu_nb
, CPU_UP_PREPARE
, (void *)(long) cpu
);
1444 open_softirq(RCU_SOFTIRQ
, rcu_process_callbacks
);
1448 * Late-boot-time RCU initialization that must wait until after scheduler
1449 * has been initialized.
1451 void __init
rcu_init_sched(void)
1453 rcu_sched_grace_period_task
= kthread_run(rcu_sched_grace_period
,
1455 "rcu_sched_grace_period");
1456 WARN_ON(IS_ERR(rcu_sched_grace_period_task
));
1459 #ifdef CONFIG_RCU_TRACE
1460 long *rcupreempt_flipctr(int cpu
)
1462 return &RCU_DATA_CPU(cpu
)->rcu_flipctr
[0];
1464 EXPORT_SYMBOL_GPL(rcupreempt_flipctr
);
1466 int rcupreempt_flip_flag(int cpu
)
1468 return per_cpu(rcu_flip_flag
, cpu
);
1470 EXPORT_SYMBOL_GPL(rcupreempt_flip_flag
);
1472 int rcupreempt_mb_flag(int cpu
)
1474 return per_cpu(rcu_mb_flag
, cpu
);
1476 EXPORT_SYMBOL_GPL(rcupreempt_mb_flag
);
1478 char *rcupreempt_try_flip_state_name(void)
1480 return rcu_try_flip_state_names
[rcu_ctrlblk
.rcu_try_flip_state
];
1482 EXPORT_SYMBOL_GPL(rcupreempt_try_flip_state_name
);
1484 struct rcupreempt_trace
*rcupreempt_trace_cpu(int cpu
)
1486 struct rcu_data
*rdp
= RCU_DATA_CPU(cpu
);
1490 EXPORT_SYMBOL_GPL(rcupreempt_trace_cpu
);
1492 #endif /* #ifdef RCU_TRACE */