• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/kernel/

Lines Matching refs:sp

39  * @sp: structure to initialize.
45 int init_srcu_struct(struct srcu_struct *sp)
47 sp->completed = 0;
48 mutex_init(&sp->mutex);
49 sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array);
50 return (sp->per_cpu_ref ? 0 : -ENOMEM);
58 static int srcu_readers_active_idx(struct srcu_struct *sp, int idx)
65 sum += per_cpu_ptr(sp->per_cpu_ref, cpu)->c[idx];
71 * @sp: which srcu_struct to count active readers (holding srcu_read_lock).
77 int srcu_readers_active(struct srcu_struct *sp)
79 return srcu_readers_active_idx(sp, 0) + srcu_readers_active_idx(sp, 1);
84 * @sp: structure to clean up.
89 void cleanup_srcu_struct(struct srcu_struct *sp)
93 sum = srcu_readers_active(sp);
97 free_percpu(sp->per_cpu_ref);
98 sp->per_cpu_ref = NULL;
103 * @sp: srcu_struct in which to register the new reader.
109 int srcu_read_lock(struct srcu_struct *sp)
114 idx = sp->completed & 0x1;
115 barrier(); /* ensure compiler looks -once- at sp->completed. */
116 per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]++;
124 * @sp: srcu_struct in which to unregister the old reader.
132 void srcu_read_unlock(struct srcu_struct *sp, int idx)
136 per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]--;
142 * @sp: srcu_struct with which to synchronize.
154 void synchronize_srcu(struct srcu_struct *sp)
158 idx = sp->completed;
159 mutex_lock(&sp->mutex);
171 if ((sp->completed - idx) >= 2) {
172 mutex_unlock(&sp->mutex);
180 * sees the new value of sp->completed will also see any preceding
190 idx = sp->completed & 0x1;
191 sp->completed++;
203 while (srcu_readers_active_idx(sp, idx))
236 mutex_unlock(&sp->mutex);
241 * @sp: srcu_struct on which to report batch completion.
247 long srcu_batches_completed(struct srcu_struct *sp)
249 return sp->completed;