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()
55 propagate_protected_usage(counter, new); in page_counter_cancel()
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) in page_counter_charge() argument
71 for (c = counter; c; c = c->parent) { in page_counter_charge()
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, in page_counter_try_charge() argument
100 for (c = counter; c; c = c->parent) { in page_counter_try_charge()
114 * counter has changed and retries. in page_counter_try_charge()
140 for (c = counter; c != *fail; c = c->parent) in page_counter_try_charge()
148 * @counter: counter
151 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages) in page_counter_uncharge() argument
155 for (c = counter; c; c = c->parent) in page_counter_uncharge()
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) in page_counter_set_max() argument
177 * below the concurrently-changing counter value. in page_counter_set_max()
184 * modified counter and retry. in page_counter_set_max()
186 usage = atomic_long_read(&counter->usage); in page_counter_set_max()
191 old = xchg(&counter->max, nr_pages); in page_counter_set_max()
193 if (atomic_long_read(&counter->usage) <= usage) in page_counter_set_max()
196 counter->max = old; in page_counter_set_max()
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) in page_counter_set_min() argument
212 WRITE_ONCE(counter->min, nr_pages); in page_counter_set_min()
214 for (c = counter; c; c = c->parent) in page_counter_set_min()
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) in page_counter_set_low() argument
229 WRITE_ONCE(counter->low, nr_pages); in page_counter_set_low()
231 for (c = counter; c; c = c->parent) in page_counter_set_low()
236 * page_counter_memparse - memparse() for page counter limits