The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.el7
------>
commit 7e96384c9557dc9bd2525a2afb95630c866c7090
Author: Andrey Ryabinin <aryabi...@virtuozzo.com>
Date:   Wed Aug 5 21:46:39 2020 +0300

    mm/memcg: fix cache growth above cache.limit_in_bytes
    
    Exceeding cache above cache.limit_in_bytes schedules high_work_func()
    which tries to reclaim 32 pages. If cache generated fast enough or it allows
    cgroup to steadily grow above cache.limit_in_bytes because we don't reclaim
    enough. Try to reclaim exceeded amount of cache instead.
    
    https://jira.sw.ru/browse/PSBM-106384
    Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 mm/memcontrol.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 9570e9d..6587cc2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3080,12 +3080,16 @@ static void reclaim_high(struct mem_cgroup *memcg,
 {
 
        do {
+               long cache_overused;
+
                if (page_counter_read(&memcg->memory) > memcg->high)
                        try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, 
0);
 
-               if (page_counter_read(&memcg->cache) > memcg->cache.limit)
-                       try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask,
-                                               MEM_CGROUP_RECLAIM_NOSWAP);
+               cache_overused = page_counter_read(&memcg->cache) -
+                       memcg->cache.limit;
+               if (cache_overused > 0)
+                       try_to_free_mem_cgroup_pages(memcg, cache_overused,
+                                       gfp_mask, MEM_CGROUP_RECLAIM_NOSWAP);
 
        } while ((memcg = parent_mem_cgroup(memcg)));
 }
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to