2 * Read-Copy Update mechanism for mutual exclusion (tree-based version)
3 * Internal non-public definitions that provide either classic
4 * or preemptable semantics.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Copyright Red Hat, 2009
21 * Copyright IBM Corporation, 2009
23 * Author: Ingo Molnar <mingo@elte.hu>
24 * Paul E. McKenney <paulmck@linux.vnet.ibm.com>
27 #include <linux/delay.h>
29 #ifdef CONFIG_TREE_PREEMPT_RCU
31 struct rcu_state rcu_preempt_state = RCU_STATE_INITIALIZER(rcu_preempt_state);
32 DEFINE_PER_CPU(struct rcu_data, rcu_preempt_data);
34 static int rcu_preempted_readers_exp(struct rcu_node *rnp);
37 * Tell them what RCU they are running.
39 static void __init rcu_bootup_announce(void)
42 "Experimental preemptable hierarchical RCU implementation.\n");
46 * Return the number of RCU-preempt batches processed thus far
47 * for debug and statistics.
49 long rcu_batches_completed_preempt(void)
51 return rcu_preempt_state.completed;
53 EXPORT_SYMBOL_GPL(rcu_batches_completed_preempt);
56 * Return the number of RCU batches processed thus far for debug & stats.
58 long rcu_batches_completed(void)
60 return rcu_batches_completed_preempt();
62 EXPORT_SYMBOL_GPL(rcu_batches_completed);
65 * Force a quiescent state for preemptible RCU.
67 void rcu_force_quiescent_state(void)
69 force_quiescent_state(&rcu_preempt_state, 0);
71 EXPORT_SYMBOL_GPL(rcu_force_quiescent_state);
74 * Record a preemptable-RCU quiescent state for the specified CPU. Note
75 * that this just means that the task currently running on the CPU is
76 * not in a quiescent state. There might be any number of tasks blocked
77 * while in an RCU read-side critical section.
79 static void rcu_preempt_qs(int cpu)
81 struct rcu_data *rdp = &per_cpu(rcu_preempt_data, cpu);
82 rdp->passed_quiesc_completed = rdp->gpnum - 1;
84 rdp->passed_quiesc = 1;
88 * We have entered the scheduler, and the current task might soon be
89 * context-switched away from. If this task is in an RCU read-side
90 * critical section, we will no longer be able to rely on the CPU to
91 * record that fact, so we enqueue the task on the appropriate entry
92 * of the blocked_tasks[] array. The task will dequeue itself when
93 * it exits the outermost enclosing RCU read-side critical section.
94 * Therefore, the current grace period cannot be permitted to complete
95 * until the blocked_tasks[] entry indexed by the low-order bit of
98 * Caller must disable preemption.
100 static void rcu_preempt_note_context_switch(int cpu)
102 struct task_struct *t = current;
105 struct rcu_data *rdp;
106 struct rcu_node *rnp;
108 if (t->rcu_read_lock_nesting &&
109 (t->rcu_read_unlock_special & RCU_READ_UNLOCK_BLOCKED) == 0) {
111 /* Possibly blocking in an RCU read-side critical section. */
112 rdp = rcu_preempt_state.rda[cpu];
114 spin_lock_irqsave(&rnp->lock, flags);
115 t->rcu_read_unlock_special |= RCU_READ_UNLOCK_BLOCKED;
116 t->rcu_blocked_node = rnp;
119 * If this CPU has already checked in, then this task
120 * will hold up the next grace period rather than the
121 * current grace period. Queue the task accordingly.
122 * If the task is queued for the current grace period
123 * (i.e., this CPU has not yet passed through a quiescent
124 * state for the current grace period), then as long
125 * as that task remains queued, the current grace period
128 * But first, note that the current CPU must still be
131 WARN_ON_ONCE((rdp->grpmask & rnp->qsmaskinit) == 0);
132 WARN_ON_ONCE(!list_empty(&t->rcu_node_entry));
133 phase = (rnp->gpnum + !(rnp->qsmask & rdp->grpmask)) & 0x1;
134 list_add(&t->rcu_node_entry, &rnp->blocked_tasks[phase]);
135 spin_unlock_irqrestore(&rnp->lock, flags);
139 * Either we were not in an RCU read-side critical section to
140 * begin with, or we have now recorded that critical section
141 * globally. Either way, we can now note a quiescent state
142 * for this CPU. Again, if we were in an RCU read-side critical
143 * section, and if that critical section was blocking the current
144 * grace period, then the fact that the task has been enqueued
145 * means that we continue to block the current grace period.
148 local_irq_save(flags);
149 t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
150 local_irq_restore(flags);
154 * Tree-preemptable RCU implementation for rcu_read_lock().
155 * Just increment ->rcu_read_lock_nesting, shared state will be updated
158 void __rcu_read_lock(void)
160 ACCESS_ONCE(current->rcu_read_lock_nesting)++;
161 barrier(); /* needed if we ever invoke rcu_read_lock in rcutree.c */
163 EXPORT_SYMBOL_GPL(__rcu_read_lock);
166 * Check for preempted RCU readers blocking the current grace period
167 * for the specified rcu_node structure. If the caller needs a reliable
168 * answer, it must hold the rcu_node's ->lock.
170 static int rcu_preempted_readers(struct rcu_node *rnp)
172 int phase = rnp->gpnum & 0x1;
174 return !list_empty(&rnp->blocked_tasks[phase]) ||
175 !list_empty(&rnp->blocked_tasks[phase + 2]);
179 * Record a quiescent state for all tasks that were previously queued
180 * on the specified rcu_node structure and that were blocking the current
181 * RCU grace period. The caller must hold the specified rnp->lock with
182 * irqs disabled, and this lock is released upon return, but irqs remain
185 static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
186 __releases(rnp->lock)
189 struct rcu_node *rnp_p;
191 if (rnp->qsmask != 0 || rcu_preempted_readers(rnp)) {
192 spin_unlock_irqrestore(&rnp->lock, flags);
193 return; /* Still need more quiescent states! */
199 * Either there is only one rcu_node in the tree,
200 * or tasks were kicked up to root rcu_node due to
201 * CPUs going offline.
203 rcu_report_qs_rsp(&rcu_preempt_state, flags);
207 /* Report up the rest of the hierarchy. */
209 spin_unlock(&rnp->lock); /* irqs remain disabled. */
210 spin_lock(&rnp_p->lock); /* irqs already disabled. */
211 rcu_report_qs_rnp(mask, &rcu_preempt_state, rnp_p, flags);
215 * Handle special cases during rcu_read_unlock(), such as needing to
216 * notify RCU core processing or task having blocked during the RCU
217 * read-side critical section.
219 static void rcu_read_unlock_special(struct task_struct *t)
224 struct rcu_node *rnp;
227 /* NMI handlers cannot block and cannot safely manipulate state. */
231 local_irq_save(flags);
234 * If RCU core is waiting for this CPU to exit critical section,
235 * let it know that we have done so.
237 special = t->rcu_read_unlock_special;
238 if (special & RCU_READ_UNLOCK_NEED_QS) {
239 t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
240 rcu_preempt_qs(smp_processor_id());
243 /* Hardware IRQ handlers cannot block. */
245 local_irq_restore(flags);
249 /* Clean up if blocked during RCU read-side critical section. */
250 if (special & RCU_READ_UNLOCK_BLOCKED) {
251 t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_BLOCKED;
254 * Remove this task from the list it blocked on. The
255 * task can migrate while we acquire the lock, but at
256 * most one time. So at most two passes through loop.
259 rnp = t->rcu_blocked_node;
260 spin_lock(&rnp->lock); /* irqs already disabled. */
261 if (rnp == t->rcu_blocked_node)
263 spin_unlock(&rnp->lock); /* irqs remain disabled. */
265 empty = !rcu_preempted_readers(rnp);
266 empty_exp = !rcu_preempted_readers_exp(rnp);
267 smp_mb(); /* ensure expedited fastpath sees end of RCU c-s. */
268 list_del_init(&t->rcu_node_entry);
269 t->rcu_blocked_node = NULL;
272 * If this was the last task on the current list, and if
273 * we aren't waiting on any CPUs, report the quiescent state.
274 * Note that rcu_report_unblock_qs_rnp() releases rnp->lock.
277 spin_unlock_irqrestore(&rnp->lock, flags);
279 rcu_report_unblock_qs_rnp(rnp, flags);
282 * If this was the last task on the expedited lists,
283 * then we need to report up the rcu_node hierarchy.
285 if (!empty_exp && !rcu_preempted_readers_exp(rnp))
286 rcu_report_exp_rnp(&rcu_preempt_state, rnp);
288 local_irq_restore(flags);
293 * Tree-preemptable RCU implementation for rcu_read_unlock().
294 * Decrement ->rcu_read_lock_nesting. If the result is zero (outermost
295 * rcu_read_unlock()) and ->rcu_read_unlock_special is non-zero, then
296 * invoke rcu_read_unlock_special() to clean up after a context switch
297 * in an RCU read-side critical section and other special cases.
299 void __rcu_read_unlock(void)
301 struct task_struct *t = current;
303 barrier(); /* needed if we ever invoke rcu_read_unlock in rcutree.c */
304 if (--ACCESS_ONCE(t->rcu_read_lock_nesting) == 0 &&
305 unlikely(ACCESS_ONCE(t->rcu_read_unlock_special)))
306 rcu_read_unlock_special(t);
307 #ifdef CONFIG_PROVE_LOCKING
308 WARN_ON_ONCE(ACCESS_ONCE(t->rcu_read_lock_nesting) < 0);
309 #endif /* #ifdef CONFIG_PROVE_LOCKING */
311 EXPORT_SYMBOL_GPL(__rcu_read_unlock);
313 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
316 * Scan the current list of tasks blocked within RCU read-side critical
317 * sections, printing out the tid of each.
319 static void rcu_print_task_stall(struct rcu_node *rnp)
322 struct list_head *lp;
324 struct task_struct *t;
326 if (rcu_preempted_readers(rnp)) {
327 spin_lock_irqsave(&rnp->lock, flags);
328 phase = rnp->gpnum & 0x1;
329 lp = &rnp->blocked_tasks[phase];
330 list_for_each_entry(t, lp, rcu_node_entry)
331 printk(" P%d", t->pid);
332 spin_unlock_irqrestore(&rnp->lock, flags);
336 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
339 * Check that the list of blocked tasks for the newly completed grace
340 * period is in fact empty. It is a serious bug to complete a grace
341 * period that still has RCU readers blocked! This function must be
342 * invoked -before- updating this rnp's ->gpnum, and the rnp's ->lock
343 * must be held by the caller.
345 static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)
347 WARN_ON_ONCE(rcu_preempted_readers(rnp));
348 WARN_ON_ONCE(rnp->qsmask);
351 #ifdef CONFIG_HOTPLUG_CPU
354 * Handle tasklist migration for case in which all CPUs covered by the
355 * specified rcu_node have gone offline. Move them up to the root
356 * rcu_node. The reason for not just moving them to the immediate
357 * parent is to remove the need for rcu_read_unlock_special() to
358 * make more than two attempts to acquire the target rcu_node's lock.
359 * Returns true if there were tasks blocking the current RCU grace
362 * Returns 1 if there was previously a task blocking the current grace
363 * period on the specified rcu_node structure.
365 * The caller must hold rnp->lock with irqs disabled.
367 static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
368 struct rcu_node *rnp,
369 struct rcu_data *rdp)
372 struct list_head *lp;
373 struct list_head *lp_root;
375 struct rcu_node *rnp_root = rcu_get_root(rsp);
376 struct task_struct *tp;
378 if (rnp == rnp_root) {
379 WARN_ONCE(1, "Last CPU thought to be offlined?");
380 return 0; /* Shouldn't happen: at least one CPU online. */
382 WARN_ON_ONCE(rnp != rdp->mynode &&
383 (!list_empty(&rnp->blocked_tasks[0]) ||
384 !list_empty(&rnp->blocked_tasks[1]) ||
385 !list_empty(&rnp->blocked_tasks[2]) ||
386 !list_empty(&rnp->blocked_tasks[3])));
389 * Move tasks up to root rcu_node. Rely on the fact that the
390 * root rcu_node can be at most one ahead of the rest of the
391 * rcu_nodes in terms of gp_num value. This fact allows us to
392 * move the blocked_tasks[] array directly, element by element.
394 if (rcu_preempted_readers(rnp))
395 retval |= RCU_OFL_TASKS_NORM_GP;
396 if (rcu_preempted_readers_exp(rnp))
397 retval |= RCU_OFL_TASKS_EXP_GP;
398 for (i = 0; i < 4; i++) {
399 lp = &rnp->blocked_tasks[i];
400 lp_root = &rnp_root->blocked_tasks[i];
401 while (!list_empty(lp)) {
402 tp = list_entry(lp->next, typeof(*tp), rcu_node_entry);
403 spin_lock(&rnp_root->lock); /* irqs already disabled */
404 list_del(&tp->rcu_node_entry);
405 tp->rcu_blocked_node = rnp_root;
406 list_add(&tp->rcu_node_entry, lp_root);
407 spin_unlock(&rnp_root->lock); /* irqs remain disabled */
414 * Do CPU-offline processing for preemptable RCU.
416 static void rcu_preempt_offline_cpu(int cpu)
418 __rcu_offline_cpu(cpu, &rcu_preempt_state);
421 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
424 * Check for a quiescent state from the current CPU. When a task blocks,
425 * the task is recorded in the corresponding CPU's rcu_node structure,
426 * which is checked elsewhere.
428 * Caller must disable hard irqs.
430 static void rcu_preempt_check_callbacks(int cpu)
432 struct task_struct *t = current;
434 if (t->rcu_read_lock_nesting == 0) {
435 t->rcu_read_unlock_special &= ~RCU_READ_UNLOCK_NEED_QS;
439 if (per_cpu(rcu_preempt_data, cpu).qs_pending)
440 t->rcu_read_unlock_special |= RCU_READ_UNLOCK_NEED_QS;
444 * Process callbacks for preemptable RCU.
446 static void rcu_preempt_process_callbacks(void)
448 __rcu_process_callbacks(&rcu_preempt_state,
449 &__get_cpu_var(rcu_preempt_data));
453 * Queue a preemptable-RCU callback for invocation after a grace period.
455 void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
457 __call_rcu(head, func, &rcu_preempt_state);
459 EXPORT_SYMBOL_GPL(call_rcu);
462 * synchronize_rcu - wait until a grace period has elapsed.
464 * Control will return to the caller some time after a full grace
465 * period has elapsed, in other words after all currently executing RCU
466 * read-side critical sections have completed. RCU read-side critical
467 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
470 void synchronize_rcu(void)
472 struct rcu_synchronize rcu;
474 if (!rcu_scheduler_active)
477 init_completion(&rcu.completion);
478 /* Will wake me after RCU finished. */
479 call_rcu(&rcu.head, wakeme_after_rcu);
481 wait_for_completion(&rcu.completion);
483 EXPORT_SYMBOL_GPL(synchronize_rcu);
485 static DECLARE_WAIT_QUEUE_HEAD(sync_rcu_preempt_exp_wq);
486 static long sync_rcu_preempt_exp_count;
487 static DEFINE_MUTEX(sync_rcu_preempt_exp_mutex);
490 * Return non-zero if there are any tasks in RCU read-side critical
491 * sections blocking the current preemptible-RCU expedited grace period.
492 * If there is no preemptible-RCU expedited grace period currently in
493 * progress, returns zero unconditionally.
495 static int rcu_preempted_readers_exp(struct rcu_node *rnp)
497 return !list_empty(&rnp->blocked_tasks[2]) ||
498 !list_empty(&rnp->blocked_tasks[3]);
502 * return non-zero if there is no RCU expedited grace period in progress
503 * for the specified rcu_node structure, in other words, if all CPUs and
504 * tasks covered by the specified rcu_node structure have done their bit
505 * for the current expedited grace period. Works only for preemptible
506 * RCU -- other RCU implementation use other means.
508 * Caller must hold sync_rcu_preempt_exp_mutex.
510 static int sync_rcu_preempt_exp_done(struct rcu_node *rnp)
512 return !rcu_preempted_readers_exp(rnp) &&
513 ACCESS_ONCE(rnp->expmask) == 0;
517 * Report the exit from RCU read-side critical section for the last task
518 * that queued itself during or before the current expedited preemptible-RCU
519 * grace period. This event is reported either to the rcu_node structure on
520 * which the task was queued or to one of that rcu_node structure's ancestors,
521 * recursively up the tree. (Calm down, calm down, we do the recursion
524 * Caller must hold sync_rcu_preempt_exp_mutex.
526 static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp)
531 spin_lock_irqsave(&rnp->lock, flags);
533 if (!sync_rcu_preempt_exp_done(rnp))
535 if (rnp->parent == NULL) {
536 wake_up(&sync_rcu_preempt_exp_wq);
540 spin_unlock(&rnp->lock); /* irqs remain disabled */
542 spin_lock(&rnp->lock); /* irqs already disabled */
543 rnp->expmask &= ~mask;
545 spin_unlock_irqrestore(&rnp->lock, flags);
549 * Snapshot the tasks blocking the newly started preemptible-RCU expedited
550 * grace period for the specified rcu_node structure. If there are no such
551 * tasks, report it up the rcu_node hierarchy.
553 * Caller must hold sync_rcu_preempt_exp_mutex and rsp->onofflock.
556 sync_rcu_preempt_exp_init(struct rcu_state *rsp, struct rcu_node *rnp)
560 spin_lock(&rnp->lock); /* irqs already disabled */
561 list_splice_init(&rnp->blocked_tasks[0], &rnp->blocked_tasks[2]);
562 list_splice_init(&rnp->blocked_tasks[1], &rnp->blocked_tasks[3]);
563 must_wait = rcu_preempted_readers_exp(rnp);
564 spin_unlock(&rnp->lock); /* irqs remain disabled */
566 rcu_report_exp_rnp(rsp, rnp);
570 * Wait for an rcu-preempt grace period, but expedite it. The basic idea
571 * is to invoke synchronize_sched_expedited() to push all the tasks to
572 * the ->blocked_tasks[] lists, move all entries from the first set of
573 * ->blocked_tasks[] lists to the second set, and finally wait for this
574 * second set to drain.
576 void synchronize_rcu_expedited(void)
579 struct rcu_node *rnp;
580 struct rcu_state *rsp = &rcu_preempt_state;
584 smp_mb(); /* Caller's modifications seen first by other CPUs. */
585 snap = ACCESS_ONCE(sync_rcu_preempt_exp_count) + 1;
586 smp_mb(); /* Above access cannot bleed into critical section. */
589 * Acquire lock, falling back to synchronize_rcu() if too many
590 * lock-acquisition failures. Of course, if someone does the
591 * expedited grace period for us, just leave.
593 while (!mutex_trylock(&sync_rcu_preempt_exp_mutex)) {
595 udelay(trycount * num_online_cpus());
600 if ((ACCESS_ONCE(sync_rcu_preempt_exp_count) - snap) > 0)
601 goto mb_ret; /* Others did our work for us. */
603 if ((ACCESS_ONCE(sync_rcu_preempt_exp_count) - snap) > 0)
604 goto unlock_mb_ret; /* Others did our work for us. */
606 /* force all RCU readers onto blocked_tasks[]. */
607 synchronize_sched_expedited();
609 spin_lock_irqsave(&rsp->onofflock, flags);
611 /* Initialize ->expmask for all non-leaf rcu_node structures. */
612 rcu_for_each_nonleaf_node_breadth_first(rsp, rnp) {
613 spin_lock(&rnp->lock); /* irqs already disabled. */
614 rnp->expmask = rnp->qsmaskinit;
615 spin_unlock(&rnp->lock); /* irqs remain disabled. */
618 /* Snapshot current state of ->blocked_tasks[] lists. */
619 rcu_for_each_leaf_node(rsp, rnp)
620 sync_rcu_preempt_exp_init(rsp, rnp);
621 if (NUM_RCU_NODES > 1)
622 sync_rcu_preempt_exp_init(rsp, rcu_get_root(rsp));
624 spin_unlock_irqrestore(&rsp->onofflock, flags);
626 /* Wait for snapshotted ->blocked_tasks[] lists to drain. */
627 rnp = rcu_get_root(rsp);
628 wait_event(sync_rcu_preempt_exp_wq,
629 sync_rcu_preempt_exp_done(rnp));
631 /* Clean up and exit. */
632 smp_mb(); /* ensure expedited GP seen before counter increment. */
633 ACCESS_ONCE(sync_rcu_preempt_exp_count)++;
635 mutex_unlock(&sync_rcu_preempt_exp_mutex);
637 smp_mb(); /* ensure subsequent action seen after grace period. */
639 EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
642 * Check to see if there is any immediate preemptable-RCU-related work
645 static int rcu_preempt_pending(int cpu)
647 return __rcu_pending(&rcu_preempt_state,
648 &per_cpu(rcu_preempt_data, cpu));
652 * Does preemptable RCU need the CPU to stay out of dynticks mode?
654 static int rcu_preempt_needs_cpu(int cpu)
656 return !!per_cpu(rcu_preempt_data, cpu).nxtlist;
660 * rcu_barrier - Wait until all in-flight call_rcu() callbacks complete.
662 void rcu_barrier(void)
664 _rcu_barrier(&rcu_preempt_state, call_rcu);
666 EXPORT_SYMBOL_GPL(rcu_barrier);
669 * Initialize preemptable RCU's per-CPU data.
671 static void __cpuinit rcu_preempt_init_percpu_data(int cpu)
673 rcu_init_percpu_data(cpu, &rcu_preempt_state, 1);
677 * Move preemptable RCU's callbacks to ->orphan_cbs_list.
679 static void rcu_preempt_send_cbs_to_orphanage(void)
681 rcu_send_cbs_to_orphanage(&rcu_preempt_state);
685 * Initialize preemptable RCU's state structures.
687 static void __init __rcu_init_preempt(void)
689 RCU_INIT_FLAVOR(&rcu_preempt_state, rcu_preempt_data);
693 * Check for a task exiting while in a preemptable-RCU read-side
694 * critical section, clean up if so. No need to issue warnings,
695 * as debug_check_no_locks_held() already does this if lockdep
700 struct task_struct *t = current;
702 if (t->rcu_read_lock_nesting == 0)
704 t->rcu_read_lock_nesting = 1;
708 #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
711 * Tell them what RCU they are running.
713 static void __init rcu_bootup_announce(void)
715 printk(KERN_INFO "Hierarchical RCU implementation.\n");
719 * Return the number of RCU batches processed thus far for debug & stats.
721 long rcu_batches_completed(void)
723 return rcu_batches_completed_sched();
725 EXPORT_SYMBOL_GPL(rcu_batches_completed);
728 * Force a quiescent state for RCU, which, because there is no preemptible
729 * RCU, becomes the same as rcu-sched.
731 void rcu_force_quiescent_state(void)
733 rcu_sched_force_quiescent_state();
735 EXPORT_SYMBOL_GPL(rcu_force_quiescent_state);
738 * Because preemptable RCU does not exist, we never have to check for
739 * CPUs being in quiescent states.
741 static void rcu_preempt_note_context_switch(int cpu)
746 * Because preemptable RCU does not exist, there are never any preempted
749 static int rcu_preempted_readers(struct rcu_node *rnp)
754 #ifdef CONFIG_HOTPLUG_CPU
756 /* Because preemptible RCU does not exist, no quieting of tasks. */
757 static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, unsigned long flags)
759 spin_unlock_irqrestore(&rnp->lock, flags);
762 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
764 #ifdef CONFIG_RCU_CPU_STALL_DETECTOR
767 * Because preemptable RCU does not exist, we never have to check for
768 * tasks blocked within RCU read-side critical sections.
770 static void rcu_print_task_stall(struct rcu_node *rnp)
774 #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
777 * Because there is no preemptable RCU, there can be no readers blocked,
778 * so there is no need to check for blocked tasks. So check only for
779 * bogus qsmask values.
781 static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)
783 WARN_ON_ONCE(rnp->qsmask);
786 #ifdef CONFIG_HOTPLUG_CPU
789 * Because preemptable RCU does not exist, it never needs to migrate
790 * tasks that were blocked within RCU read-side critical sections, and
791 * such non-existent tasks cannot possibly have been blocking the current
794 static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
795 struct rcu_node *rnp,
796 struct rcu_data *rdp)
802 * Because preemptable RCU does not exist, it never needs CPU-offline
805 static void rcu_preempt_offline_cpu(int cpu)
809 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
812 * Because preemptable RCU does not exist, it never has any callbacks
815 static void rcu_preempt_check_callbacks(int cpu)
820 * Because preemptable RCU does not exist, it never has any callbacks
823 static void rcu_preempt_process_callbacks(void)
828 * In classic RCU, call_rcu() is just call_rcu_sched().
830 void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu))
832 call_rcu_sched(head, func);
834 EXPORT_SYMBOL_GPL(call_rcu);
837 * Wait for an rcu-preempt grace period, but make it happen quickly.
838 * But because preemptable RCU does not exist, map to rcu-sched.
840 void synchronize_rcu_expedited(void)
842 synchronize_sched_expedited();
844 EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
846 #ifdef CONFIG_HOTPLUG_CPU
849 * Because preemptable RCU does not exist, there is never any need to
850 * report on tasks preempted in RCU read-side critical sections during
851 * expedited RCU grace periods.
853 static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp)
858 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
861 * Because preemptable RCU does not exist, it never has any work to do.
863 static int rcu_preempt_pending(int cpu)
869 * Because preemptable RCU does not exist, it never needs any CPU.
871 static int rcu_preempt_needs_cpu(int cpu)
877 * Because preemptable RCU does not exist, rcu_barrier() is just
878 * another name for rcu_barrier_sched().
880 void rcu_barrier(void)
884 EXPORT_SYMBOL_GPL(rcu_barrier);
887 * Because preemptable RCU does not exist, there is no per-CPU
888 * data to initialize.
890 static void __cpuinit rcu_preempt_init_percpu_data(int cpu)
895 * Because there is no preemptable RCU, there are no callbacks to move.
897 static void rcu_preempt_send_cbs_to_orphanage(void)
902 * Because preemptable RCU does not exist, it need not be initialized.
904 static void __init __rcu_init_preempt(void)
908 #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */