diff options
Diffstat (limited to 'include/linux/rcuclassic.h')
| -rw-r--r-- | include/linux/rcuclassic.h | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h deleted file mode 100644 index bfd92e1e5d2c..000000000000 --- a/include/linux/rcuclassic.h +++ /dev/null | |||
| @@ -1,178 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Read-Copy Update mechanism for mutual exclusion (classic version) | ||
| 3 | * | ||
| 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. | ||
| 8 | * | ||
| 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. | ||
| 13 | * | ||
| 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. | ||
| 17 | * | ||
| 18 | * Copyright IBM Corporation, 2001 | ||
| 19 | * | ||
| 20 | * Author: Dipankar Sarma <dipankar@in.ibm.com> | ||
| 21 | * | ||
| 22 | * Based on the original work by Paul McKenney <paulmck@us.ibm.com> | ||
| 23 | * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. | ||
| 24 | * Papers: | ||
| 25 | * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf | ||
| 26 | * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) | ||
| 27 | * | ||
| 28 | * For detailed explanation of Read-Copy Update mechanism see - | ||
| 29 | * Documentation/RCU | ||
| 30 | * | ||
| 31 | */ | ||
| 32 | |||
| 33 | #ifndef __LINUX_RCUCLASSIC_H | ||
| 34 | #define __LINUX_RCUCLASSIC_H | ||
| 35 | |||
| 36 | #include <linux/cache.h> | ||
| 37 | #include <linux/spinlock.h> | ||
| 38 | #include <linux/threads.h> | ||
| 39 | #include <linux/cpumask.h> | ||
| 40 | #include <linux/seqlock.h> | ||
| 41 | |||
| 42 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
| 43 | #define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rcp->jiffies_stall */ | ||
| 44 | #define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */ | ||
| 45 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
| 46 | |||
| 47 | /* Global control variables for rcupdate callback mechanism. */ | ||
| 48 | struct rcu_ctrlblk { | ||
| 49 | long cur; /* Current batch number. */ | ||
| 50 | long completed; /* Number of the last completed batch */ | ||
| 51 | long pending; /* Number of the last pending batch */ | ||
| 52 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | ||
| 53 | unsigned long gp_start; /* Time at which GP started in jiffies. */ | ||
| 54 | unsigned long jiffies_stall; | ||
| 55 | /* Time at which to check for CPU stalls. */ | ||
| 56 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | ||
| 57 | |||
| 58 | int signaled; | ||
| 59 | |||
| 60 | spinlock_t lock ____cacheline_internodealigned_in_smp; | ||
| 61 | DECLARE_BITMAP(cpumask, NR_CPUS); /* CPUs that need to switch for */ | ||
| 62 | /* current batch to proceed. */ | ||
| 63 | } ____cacheline_internodealigned_in_smp; | ||
| 64 | |||
| 65 | /* Is batch a before batch b ? */ | ||
| 66 | static inline int rcu_batch_before(long a, long b) | ||
| 67 | { | ||
| 68 | return (a - b) < 0; | ||
| 69 | } | ||
| 70 | |||
| 71 | /* Is batch a after batch b ? */ | ||
| 72 | static inline int rcu_batch_after(long a, long b) | ||
| 73 | { | ||
| 74 | return (a - b) > 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | /* Per-CPU data for Read-Copy UPdate. */ | ||
| 78 | struct rcu_data { | ||
| 79 | /* 1) quiescent state handling : */ | ||
| 80 | long quiescbatch; /* Batch # for grace period */ | ||
| 81 | int passed_quiesc; /* User-mode/idle loop etc. */ | ||
| 82 | int qs_pending; /* core waits for quiesc state */ | ||
| 83 | |||
| 84 | /* 2) batch handling */ | ||
| 85 | /* | ||
| 86 | * if nxtlist is not NULL, then: | ||
| 87 | * batch: | ||
| 88 | * The batch # for the last entry of nxtlist | ||
| 89 | * [*nxttail[1], NULL = *nxttail[2]): | ||
| 90 | * Entries that batch # <= batch | ||
| 91 | * [*nxttail[0], *nxttail[1]): | ||
| 92 | * Entries that batch # <= batch - 1 | ||
| 93 | * [nxtlist, *nxttail[0]): | ||
| 94 | * Entries that batch # <= batch - 2 | ||
| 95 | * The grace period for these entries has completed, and | ||
| 96 | * the other grace-period-completed entries may be moved | ||
| 97 | * here temporarily in rcu_process_callbacks(). | ||
| 98 | */ | ||
| 99 | long batch; | ||
| 100 | struct rcu_head *nxtlist; | ||
| 101 | struct rcu_head **nxttail[3]; | ||
| 102 | long qlen; /* # of queued callbacks */ | ||
| 103 | struct rcu_head *donelist; | ||
| 104 | struct rcu_head **donetail; | ||
| 105 | long blimit; /* Upper limit on a processed batch */ | ||
| 106 | int cpu; | ||
| 107 | struct rcu_head barrier; | ||
| 108 | }; | ||
| 109 | |||
| 110 | /* | ||
| 111 | * Increment the quiescent state counter. | ||
| 112 | * The counter is a bit degenerated: We do not need to know | ||
| 113 | * how many quiescent states passed, just if there was at least | ||
| 114 | * one since the start of the grace period. Thus just a flag. | ||
| 115 | */ | ||
| 116 | extern void rcu_qsctr_inc(int cpu); | ||
| 117 | extern void rcu_bh_qsctr_inc(int cpu); | ||
| 118 | |||
| 119 | extern int rcu_pending(int cpu); | ||
| 120 | extern int rcu_needs_cpu(int cpu); | ||
| 121 | |||
| 122 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 123 | extern struct lockdep_map rcu_lock_map; | ||
| 124 | # define rcu_read_acquire() \ | ||
| 125 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) | ||
| 126 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | ||
| 127 | #else | ||
| 128 | # define rcu_read_acquire() do { } while (0) | ||
| 129 | # define rcu_read_release() do { } while (0) | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #define __rcu_read_lock() \ | ||
| 133 | do { \ | ||
| 134 | preempt_disable(); \ | ||
| 135 | __acquire(RCU); \ | ||
| 136 | rcu_read_acquire(); \ | ||
| 137 | } while (0) | ||
| 138 | #define __rcu_read_unlock() \ | ||
| 139 | do { \ | ||
| 140 | rcu_read_release(); \ | ||
| 141 | __release(RCU); \ | ||
| 142 | preempt_enable(); \ | ||
| 143 | } while (0) | ||
| 144 | #define __rcu_read_lock_bh() \ | ||
| 145 | do { \ | ||
| 146 | local_bh_disable(); \ | ||
| 147 | __acquire(RCU_BH); \ | ||
| 148 | rcu_read_acquire(); \ | ||
| 149 | } while (0) | ||
| 150 | #define __rcu_read_unlock_bh() \ | ||
| 151 | do { \ | ||
| 152 | rcu_read_release(); \ | ||
| 153 | __release(RCU_BH); \ | ||
| 154 | local_bh_enable(); \ | ||
| 155 | } while (0) | ||
| 156 | |||
| 157 | #define __synchronize_sched() synchronize_rcu() | ||
| 158 | |||
| 159 | #define call_rcu_sched(head, func) call_rcu(head, func) | ||
| 160 | |||
| 161 | extern void __rcu_init(void); | ||
| 162 | #define rcu_init_sched() do { } while (0) | ||
| 163 | extern void rcu_check_callbacks(int cpu, int user); | ||
| 164 | extern void rcu_restart_cpu(int cpu); | ||
| 165 | |||
| 166 | extern long rcu_batches_completed(void); | ||
| 167 | extern long rcu_batches_completed_bh(void); | ||
| 168 | |||
| 169 | #define rcu_enter_nohz() do { } while (0) | ||
| 170 | #define rcu_exit_nohz() do { } while (0) | ||
| 171 | |||
| 172 | /* A context switch is a grace period for rcuclassic. */ | ||
| 173 | static inline int rcu_blocking_is_gp(void) | ||
| 174 | { | ||
| 175 | return num_online_cpus() == 1; | ||
| 176 | } | ||
| 177 | |||
| 178 | #endif /* __LINUX_RCUCLASSIC_H */ | ||
