Lines Matching defs:pl

90 int fprop_local_init_single(struct fprop_local_single *pl)
92 pl->events = 0;
93 pl->period = 0;
94 raw_spin_lock_init(&pl->lock);
98 void fprop_local_destroy_single(struct fprop_local_single *pl)
103 struct fprop_local_single *pl)
109 if (pl->period == period)
111 raw_spin_lock_irqsave(&pl->lock, flags);
112 /* Someone updated pl->period while we were spinning? */
113 if (pl->period >= period) {
114 raw_spin_unlock_irqrestore(&pl->lock, flags);
118 if (period - pl->period < BITS_PER_LONG)
119 pl->events >>= period - pl->period;
121 pl->events = 0;
122 pl->period = period;
123 raw_spin_unlock_irqrestore(&pl->lock, flags);
126 /* Event of type pl happened */
127 void __fprop_inc_single(struct fprop_global *p, struct fprop_local_single *pl)
129 fprop_reflect_period_single(p, pl);
130 pl->events++;
134 /* Return fraction of events of type pl */
136 struct fprop_local_single *pl,
144 fprop_reflect_period_single(p, pl);
145 num = pl->events;
168 int fprop_local_init_percpu(struct fprop_local_percpu *pl, gfp_t gfp)
172 err = percpu_counter_init(&pl->events, 0, gfp);
175 pl->period = 0;
176 raw_spin_lock_init(&pl->lock);
180 void fprop_local_destroy_percpu(struct fprop_local_percpu *pl)
182 percpu_counter_destroy(&pl->events);
186 struct fprop_local_percpu *pl)
192 if (pl->period == period)
194 raw_spin_lock_irqsave(&pl->lock, flags);
195 /* Someone updated pl->period while we were spinning? */
196 if (pl->period >= period) {
197 raw_spin_unlock_irqrestore(&pl->lock, flags);
201 if (period - pl->period < BITS_PER_LONG) {
202 s64 val = percpu_counter_read(&pl->events);
205 val = percpu_counter_sum(&pl->events);
207 percpu_counter_add_batch(&pl->events,
208 -val + (val >> (period-pl->period)), PROP_BATCH);
210 percpu_counter_set(&pl->events, 0);
211 pl->period = period;
212 raw_spin_unlock_irqrestore(&pl->lock, flags);
215 /* Event of type pl happened */
216 void __fprop_add_percpu(struct fprop_global *p, struct fprop_local_percpu *pl,
219 fprop_reflect_period_percpu(p, pl);
220 percpu_counter_add_batch(&pl->events, nr, PROP_BATCH);
225 struct fprop_local_percpu *pl,
233 fprop_reflect_period_percpu(p, pl);
234 num = percpu_counter_read_positive(&pl->events);
257 struct fprop_local_percpu *pl, int max_frac, long nr)
263 fprop_fraction_percpu(p, pl, &numerator, &denominator);
277 __fprop_add_percpu(p, pl, nr);