From: Johannes Weiner <[email protected]> When setting memory.high below usage, nothing happens until the next charge comes along, and then it will only reclaim its own charge and not the now potentially huge excess of the new memory.high. This can cause groups to stay in excess of their memory.high indefinitely.
To fix that, when shrinking memory.high, kick off a reclaim cycle that goes after the delta. https://jira.sw.ru/browse/PSBM-48546 Signed-off-by: Johannes Weiner <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Vladimir Davydov <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> (cherry picked from commit 588083bb37a3cea8533c392370a554417c8f29cb) Signed-off-by: Vladimir Davydov <[email protected]> Conflicts: mm/memcontrol.c --- mm/memcontrol.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index de7c36295515..1f525f27e481 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5314,7 +5314,7 @@ static int mem_cgroup_high_write(struct cgroup *cont, struct cftype *cft, const char *buffer) { struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); - unsigned long long val; + unsigned long long val, usage; int ret; ret = res_counter_memparse_write_strategy(buffer, &val); @@ -5322,6 +5322,12 @@ static int mem_cgroup_high_write(struct cgroup *cont, struct cftype *cft, return ret; memcg->high = val; + + usage = res_counter_read_u64(&memcg->res, RES_USAGE); + if (usage > val) + try_to_free_mem_cgroup_pages(memcg, + (usage - val) >> PAGE_SHIFT, + GFP_KERNEL, false); return 0; } -- 2.1.4 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
