Lines Matching full:counter
51 * page_counter_cancel - take pages out of the local counter
52 * @counter: counter
55 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages) in page_counter_cancel() argument
59 new = atomic_long_sub_return(nr_pages, &counter->usage); in page_counter_cancel()
60 propagate_protected_usage(counter, new); in page_counter_cancel()
67 * @counter: counter
70 * NOTE: This does not consider any configured counter limits.
72 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) in page_counter_charge() argument
76 for (c = counter; c; c = c->parent) { in page_counter_charge()
92 * @counter: counter
94 * @fail: points first counter to hit its limit, if any
96 * Returns %true on success, or %false and @fail if the counter or one
99 bool page_counter_try_charge(struct page_counter *counter, in page_counter_try_charge() argument
105 for (c = counter; c; c = c->parent) { in page_counter_try_charge()
119 * 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 = atomic_long_read(&counter->usage); in page_counter_set_max()
195 old = xchg(&counter->max, nr_pages); in page_counter_set_max()
197 if (atomic_long_read(&counter->usage) <= 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 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 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