mm: memcontrol: drain stocks on resize limit
Subsystems (3)
PATCH 1/1 mm: memcontrol: drain stocks on resize limit
Resizing the memcg limit for cgroup-v2 drains the stocks before triggering the memcg reclaim. Do the same for cgroup-v1 to make the behavior consistent.
Signed-off-by Shakeel Butt <[email protected]>
--- mm/memcontrol.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/memcontrol.c +7 -0
@@ -2463,6 +2463,7 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg, unsigned long max, bool memsw) { bool enlarge = false; +bool drained = false;int ret;bool limits_invariant;struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory;
@@ -2493,6 +2494,12 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,if (!ret)break ; +if (!drained) { +drain_all_stock (memcg); + drained = true; +continue ; + } +if (!try_to_free_mem_cgroup_pages (memcg,1 ,GFP_KERNEL , !memsw)) { ret = -EBUSY ;
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
Quoted 5 lines · Shakeel Butt
Resizing the memcg limit for cgroup-v2 drains the stocks before triggering the memcg reclaim. Do the same for cgroup-v1 to make the behavior consistent.
Signed-off-by Shakeel Butt <[email protected]>
Acked-by Johannes Weiner <[email protected]>
Quoted 5 lines · Shakeel Butt
Resizing the memcg limit for cgroup-v2 drains the stocks before triggering the memcg reclaim. Do the same for cgroup-v1 to make the behavior consistent.
Signed-off-by Shakeel Butt <[email protected]>
Acked-by Michal Hocko <[email protected]>
Quoted 31 lines
--- mm/memcontrol.c | 7 +++++++ 1 file changed, 7 insertions(+)mm/memcontrol.c +7
-0@@ -2463,6 +2463,7 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg, unsigned long max, bool memsw) { bool enlarge = false; +bool drained = false;int ret;bool limits_invariant;struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory;@@ -2493,6 +2494,12 @@ static int mem_cgroup_resize_max(struct mem_cgroup *memcg,if (!ret)break ; +if (!drained) { +drain_all_stock (memcg); + drained = true; +continue ; + } +if (!try_to_free_mem_cgroup_pages (memcg,1 ,GFP_KERNEL , !memsw)) { ret = -EBUSY ;Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
Signature · 2 lines
Michal Hocko SUSE Labs