Lines Matching full: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) in page_counter_cancel() argument
53 new = atomic_long_sub_return(nr_pages, &counter->usage); in page_counter_cancel()
58 atomic_long_set(&counter->usage, new); in page_counter_cancel()
60 propagate_protected_usage(counter, new); in page_counter_cancel()
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) in page_counter_charge() argument
74 for (c = counter; c; c = c->parent) { in page_counter_charge()
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, in page_counter_try_charge() argument
103 for (c = counter; c; c = c->parent) { in page_counter_try_charge()
117 * counter has changed and retries. in page_counter_try_charge()
142 for (c = counter; c != *fail; c = c->parent) in page_counter_try_charge()
150 * @counter: counter
153 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages) in page_counter_uncharge() argument
157 for (c = counter; c; c = c->parent) in page_counter_uncharge()
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) in page_counter_set_max() argument
179 * below the concurrently-changing counter value. in page_counter_set_max()
186 * modified counter and retry. in page_counter_set_max()
188 usage = page_counter_read(counter); in page_counter_set_max()
193 old = xchg(&counter->max, nr_pages); in page_counter_set_max()
195 if (page_counter_read(counter) <= usage || nr_pages >= old) in page_counter_set_max()
198 counter->max = old; in page_counter_set_max()
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) in page_counter_set_min() argument
214 WRITE_ONCE(counter->min, nr_pages); in page_counter_set_min()
216 for (c = counter; c; c = c->parent) in page_counter_set_min()
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) in page_counter_set_low() argument
231 WRITE_ONCE(counter->low, nr_pages); in page_counter_set_low()
233 for (c = counter; c; c = c->parent) in page_counter_set_low()
238 * page_counter_memparse - memparse() for page counter limits