Lines Matching defs:counter

45  * page_counter_cancel - take pages out of the local counter
46 * @counter: counter
49 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages)
53 new = atomic_long_sub_return(nr_pages, &counter->usage);
58 atomic_long_set(&counter->usage, new);
60 propagate_protected_usage(counter, new);
65 * @counter: counter
68 * NOTE: This does not consider any configured counter limits.
70 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages)
74 for (c = counter; c; c = c->parent) {
90 * @counter: counter
92 * @fail: points first counter to hit its limit, if any
94 * Returns %true on success, or %false and @fail if the counter or one
97 bool page_counter_try_charge(struct page_counter *counter,
103 for (c = counter; c; c = c->parent) {
117 * counter has changed and retries.
142 for (c = counter; c != *fail; c = c->parent)
150 * @counter: counter
153 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages)
157 for (c = counter; c; c = c->parent)
163 * @counter: counter
167 * counter already exceeds the specified limit.
169 * The caller must serialize invocations on the same counter.
171 int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages)
179 * below the concurrently-changing counter value.
186 * modified counter and retry.
188 usage = page_counter_read(counter);
193 old = xchg(&counter->max, nr_pages);
195 if (page_counter_read(counter) <= usage || nr_pages >= old)
198 counter->max = old;
205 * @counter: counter
208 * The caller must serialize invocations on the same counter.
210 void page_counter_set_min(struct page_counter *counter, unsigned long nr_pages)
214 WRITE_ONCE(counter->min, nr_pages);
216 for (c = counter; c; c = c->parent)
222 * @counter: counter
225 * The caller must serialize invocations on the same counter.
227 void page_counter_set_low(struct page_counter *counter, unsigned long nr_pages)
231 WRITE_ONCE(counter->low, nr_pages);
233 for (c = counter; c; c = c->parent)
238 * page_counter_memparse - memparse() for page counter limits