rcu: repair code-duplication FIXMEs
[linux-2.6/x86.git] / include / linux / rcutiny.h
blobc6b11dc5ba0ac2ca4b0ef38476d8444731577200
1 /*
2 * Read-Copy Update mechanism for mutual exclusion, the Bloatwatch edition.
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, 2008
20 * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
22 * For detailed explanation of Read-Copy Update mechanism see -
23 * Documentation/RCU
25 #ifndef __LINUX_TINY_H
26 #define __LINUX_TINY_H
28 #include <linux/cache.h>
30 void rcu_sched_qs(int cpu);
31 void rcu_bh_qs(int cpu);
33 #ifdef CONFIG_TINY_RCU
34 #define __rcu_read_lock() preempt_disable()
35 #define __rcu_read_unlock() preempt_enable()
36 #else /* #ifdef CONFIG_TINY_RCU */
37 void __rcu_read_lock(void);
38 void __rcu_read_unlock(void);
39 #endif /* #else #ifdef CONFIG_TINY_RCU */
40 #define __rcu_read_lock_bh() local_bh_disable()
41 #define __rcu_read_unlock_bh() local_bh_enable()
42 extern void call_rcu_sched(struct rcu_head *head,
43 void (*func)(struct rcu_head *rcu));
45 #define rcu_init_sched() do { } while (0)
47 extern void synchronize_sched(void);
49 #ifdef CONFIG_TINY_RCU
51 #define call_rcu call_rcu_sched
53 static inline void synchronize_rcu(void)
55 synchronize_sched();
58 static inline void synchronize_rcu_expedited(void)
60 synchronize_sched(); /* Only one CPU, so pretty fast anyway!!! */
63 static inline void rcu_barrier(void)
65 rcu_barrier_sched(); /* Only one CPU, so only one list of callbacks! */
68 #else /* #ifdef CONFIG_TINY_RCU */
70 void synchronize_rcu(void);
71 void rcu_barrier(void);
72 void synchronize_rcu_expedited(void);
74 #endif /* #else #ifdef CONFIG_TINY_RCU */
76 static inline void synchronize_rcu_bh(void)
78 synchronize_sched();
81 static inline void synchronize_rcu_bh_expedited(void)
83 synchronize_sched();
86 struct notifier_block;
88 #ifdef CONFIG_NO_HZ
90 extern void rcu_enter_nohz(void);
91 extern void rcu_exit_nohz(void);
93 #else /* #ifdef CONFIG_NO_HZ */
95 static inline void rcu_enter_nohz(void)
99 static inline void rcu_exit_nohz(void)
103 #endif /* #else #ifdef CONFIG_NO_HZ */
105 #ifdef CONFIG_TINY_RCU
107 static inline void rcu_preempt_note_context_switch(void)
111 static inline void exit_rcu(void)
115 static inline int rcu_needs_cpu(int cpu)
117 return 0;
120 static inline int rcu_preempt_depth(void)
122 return 0;
125 #else /* #ifdef CONFIG_TINY_RCU */
127 void rcu_preempt_note_context_switch(void);
128 extern void exit_rcu(void);
129 int rcu_preempt_needs_cpu(void);
131 static inline int rcu_needs_cpu(int cpu)
133 return rcu_preempt_needs_cpu();
136 #endif /* #else #ifdef CONFIG_TINY_RCU */
138 static inline void rcu_note_context_switch(int cpu)
140 rcu_sched_qs(cpu);
141 rcu_preempt_note_context_switch();
144 extern void rcu_check_callbacks(int cpu, int user);
147 * Return the number of grace periods.
149 static inline long rcu_batches_completed(void)
151 return 0;
155 * Return the number of bottom-half grace periods.
157 static inline long rcu_batches_completed_bh(void)
159 return 0;
162 static inline void rcu_force_quiescent_state(void)
166 static inline void rcu_bh_force_quiescent_state(void)
170 static inline void rcu_sched_force_quiescent_state(void)
174 static inline void rcu_cpu_stall_reset(void)
178 #ifdef CONFIG_DEBUG_LOCK_ALLOC
180 extern int rcu_scheduler_active __read_mostly;
181 extern void rcu_scheduler_starting(void);
183 #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
185 static inline void rcu_scheduler_starting(void)
189 #endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
191 #endif /* __LINUX_RCUTINY_H */