History

mm/memcg: move cgroup high memory limit setting into struct page_counter

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.

Jakub Kicinski committed 6 years ago

Commit d1663a91 parent ff144e63 files · +19 −11Browse files

Showing the changes to include/linux (2 of 3 files). Show all

Unified · Split

2 files
  1. include/linux/memcontrol.h +0 −3
  2. include/linux/page_counter.h +8 −0
include/linux/memcontrol.h+0−3
@@ -215,9 +215,6 @@ struct mem_cgroup { · 214 unmodified lines
215 struct page_counter kmem;215 struct page_counter kmem;
216 struct page_counter tcpmem;216 struct page_counter tcpmem;
217 217
218 /* Upper bound of normal memory consumption range */
219 unsigned long high;
220
221 /* Range enforcement for interrupt charges */218 /* Range enforcement for interrupt charges */
222 struct work_struct high_work;219 struct work_struct high_work;
223 220
include/linux/page_counter.h+8−0
@@ -10,6 +10,7 @@ struct page_counter { · 9 unmodified lines
10 atomic_long_t usage;10 atomic_long_t usage;
11 unsigned long min;11 unsigned long min;
12 unsigned long low;12 unsigned long low;
13 unsigned long high;
13 unsigned long max;14 unsigned long max;
14 struct page_counter *parent;15 struct page_counter *parent;
15 16
@@ -55,6 +56,13 @@ bool page_counter_try_charge(struct page_counter *counter, · 39 unmodified lines
55void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages);56void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages);
56void page_counter_set_min(struct page_counter *counter, unsigned long nr_pages);57void page_counter_set_min(struct page_counter *counter, unsigned long nr_pages);
57void page_counter_set_low(struct page_counter *counter, unsigned long nr_pages);58void page_counter_set_low(struct page_counter *counter, unsigned long nr_pages);
59
60static inline void page_counter_set_high(struct page_counter *counter,
61 unsigned long nr_pages)
62{
63 WRITE_ONCE(counter->high, nr_pages);
64}
65
58int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages);66int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages);
59int page_counter_memparse(const char *buf, const char *max,67int page_counter_memparse(const char *buf, const char *max,
60 unsigned long *nr_pages);68 unsigned long *nr_pages);