Lines Matching defs:counter

46  * page_counter_cancel - take pages out of the local counter
47 * @counter: counter
50 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages)
54 new = atomic_long_sub_return(nr_pages, &counter->usage);
55 propagate_protected_usage(counter, new);
62 * @counter: counter
65 * NOTE: This does not consider any configured counter limits.
67 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages)
71 for (c = counter; c; c = c->parent) {
87 * @counter: counter
89 * @fail: points first counter to hit its limit, if any
91 * Returns %true on success, or %false and @fail if the counter or one
94 bool page_counter_try_charge(struct page_counter *counter,
100 for (c = counter; c; c = c->parent) {
114 * counter has changed and retries.
140 for (c = counter; c != *fail; c = c->parent)
148 * @counter: counter
151 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages)
155 for (c = counter; c; c = c->parent)
161 * @counter: counter
165 * counter already exceeds the specified limit.
167 * The caller must serialize invocations on the same counter.
169 int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages)
177 * below the concurrently-changing counter value.
184 * modified counter and retry.
186 usage = atomic_long_read(&counter->usage);
191 old = xchg(&counter->max, nr_pages);
193 if (atomic_long_read(&counter->usage) <= usage)
196 counter->max = old;
203 * @counter: counter
206 * The caller must serialize invocations on the same counter.
208 void page_counter_set_min(struct page_counter *counter, unsigned long nr_pages)
212 WRITE_ONCE(counter->min, nr_pages);
214 for (c = counter; c; c = c->parent)
220 * @counter: counter
223 * The caller must serialize invocations on the same counter.
225 void page_counter_set_low(struct page_counter *counter, unsigned long nr_pages)
229 WRITE_ONCE(counter->low, nr_pages);
231 for (c = counter; c; c = c->parent)
236 * page_counter_memparse - memparse() for page counter limits