On Tue, May 19, 2020 at 10:19 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > High memory limit is currently recorded directly in > struct mem_cgroup. We are about to add a high limit > for swap, move the field to struct page_counter and > add some helpers. > > Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx> > --- a/include/linux/page_counter.h > +++ b/include/linux/page_counter.h ... [snip] ... > > +static inline bool page_counter_is_above_high(struct page_counter *counter) > +{ > + return page_counter_read(counter) > READ_ONCE(counter->high); > +} > + ... [snip] ... > --- a/mm/page_counter.c > +++ b/mm/page_counter.c > @@ -198,6 +198,11 @@ int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages) > } > } > > +void page_counter_set_high(struct page_counter *counter, unsigned long nr_pages) > +{ > + WRITE_ONCE(counter->high, nr_pages); > +} > + Any reason not to make this static inline like page_counter_is_above_high() and in page_counter.h?