Lines Matching full: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) in page_counter_cancel() argument
54 new = atomic_long_sub_return(nr_pages, &counter->usage); in page_counter_cancel()
59 atomic_long_set(&counter->usage, new); in page_counter_cancel()
61 propagate_protected_usage(counter, new); in page_counter_cancel()
66 * @counter: counter
69 * NOTE: This does not consider any configured counter limits.
71 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) in page_counter_charge() argument
75 for (c = counter; c; c = c->parent) { in page_counter_charge()
91 * @counter: counter
93 * @fail: points first counter to hit its limit, if any
95 * Returns %true on success, or %false and @fail if the counter or one
98 bool page_counter_try_charge(struct page_counter *counter, in page_counter_try_charge() argument
104 for (c = counter; c; c = c->parent) { in page_counter_try_charge()
118 * counter has changed and retries. in page_counter_try_charge()
144 for (c = counter; c != *fail; c = c->parent) in page_counter_try_charge()
152 * @counter: counter
155 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages) in page_counter_uncharge() argument
159 for (c = counter; c; c = c->parent) in page_counter_uncharge()
165 * @counter: counter
169 * counter already exceeds the specified limit.
171 * The caller must serialize invocations on the same counter.
173 int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages) in page_counter_set_max() argument
181 * below the concurrently-changing counter value. in page_counter_set_max()
188 * modified counter and retry. in page_counter_set_max()
190 usage = page_counter_read(counter); in page_counter_set_max()
195 old = xchg(&counter->max, nr_pages); in page_counter_set_max()
197 if (page_counter_read(counter) <= usage) in page_counter_set_max()
200 counter->max = old; in page_counter_set_max()
207 * @counter: counter
210 * The caller must serialize invocations on the same counter.
212 void page_counter_set_min(struct page_counter *counter, unsigned long nr_pages) in page_counter_set_min() argument
216 WRITE_ONCE(counter->min, nr_pages); in page_counter_set_min()
218 for (c = counter; c; c = c->parent) in page_counter_set_min()
224 * @counter: counter
227 * The caller must serialize invocations on the same counter.
229 void page_counter_set_low(struct page_counter *counter, unsigned long nr_pages) in page_counter_set_low() argument
233 WRITE_ONCE(counter->low, nr_pages); in page_counter_set_low()
235 for (c = counter; c; c = c->parent) in page_counter_set_low()
240 * page_counter_memparse - memparse() for page counter limits