Lines Matching defs:pl
94 int fprop_local_init_single(struct fprop_local_single *pl)
96 pl->events = 0;
97 pl->period = 0;
98 raw_spin_lock_init(&pl->lock);
102 void fprop_local_destroy_single(struct fprop_local_single *pl)
107 struct fprop_local_single *pl)
113 if (pl->period == period)
115 raw_spin_lock_irqsave(&pl->lock, flags);
116 /* Someone updated pl->period while we were spinning? */
117 if (pl->period >= period) {
118 raw_spin_unlock_irqrestore(&pl->lock, flags);
122 if (period - pl->period < BITS_PER_LONG)
123 pl->events >>= period - pl->period;
125 pl->events = 0;
126 pl->period = period;
127 raw_spin_unlock_irqrestore(&pl->lock, flags);
130 /* Event of type pl happened */
131 void __fprop_inc_single(struct fprop_global *p, struct fprop_local_single *pl)
133 fprop_reflect_period_single(p, pl);
134 pl->events++;
138 /* Return fraction of events of type pl */
140 struct fprop_local_single *pl,
148 fprop_reflect_period_single(p, pl);
149 num = pl->events;
172 int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp)
176 err = percpu_counter_init(&pl->events, 0, gfp);
179 pl->period = 0;
180 raw_spin_lock_init(&pl->lock);
184 void fprop_local_destroy_percpu(struct fprop_local_percpu *pl)
186 percpu_counter_destroy(&pl->events);
190 struct fprop_local_percpu *pl)
196 if (pl->period == period)
198 raw_spin_lock_irqsave(&pl->lock, flags);
199 /* Someone updated pl->period while we were spinning? */
200 if (pl->period >= period) {
201 raw_spin_unlock_irqrestore(&pl->lock, flags);
205 if (period - pl->period < BITS_PER_LONG) {
206 s64 val = percpu_counter_read(&pl->events);
209 val = percpu_counter_sum(&pl->events);
211 percpu_counter_add_batch(&pl->events,
212 -val + (val >> (period-pl->period)), PROP_BATCH);
214 percpu_counter_set(&pl->events, 0);
215 pl->period = period;
216 raw_spin_unlock_irqrestore(&pl->lock, flags);
219 /* Event of type pl happened */
220 void __fprop_inc_percpu(struct fprop_global *p, struct fprop_local_percpu *pl)
222 fprop_reflect_period_percpu(p, pl);
223 percpu_counter_add_batch(&pl->events, 1, PROP_BATCH);
228 struct fprop_local_percpu *pl,
236 fprop_reflect_period_percpu(p, pl);
237 num = percpu_counter_read_positive(&pl->events);
260 struct fprop_local_percpu *pl, int max_frac)
265 fprop_fraction_percpu(p, pl, &numerator, &denominator);
271 __fprop_inc_percpu(p, pl);