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.vz7.163.36
------>
commit 42198a2e87454cd34c2a61a86e4ffb90d0b19e0c
Author: Andrey Ryabinin <[email protected]>
Date:   Mon Oct 12 19:07:53 2020 +0300

    mm/memcg: optimize mem_cgroup_enough_memory()
    
    mem_cgroup_enough_memory() iterates memcg's subtree to account
    'MEM_CGROUP_STAT_CACHE - MEM_CGROUP_STAT_SHMEM'.
    
    Fortunately we can just read memcg->cache counter instead
    as it's hierarchical (includes subgroups) and doesn't account
    shmem.
    
    https://jira.sw.ru/browse/PSBM-120968
    Signed-off-by: Andrey Ryabinin <[email protected]>
---
 mm/memcontrol.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index fe06c7d..e0e113b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4723,11 +4723,7 @@ int mem_cgroup_enough_memory(struct mem_cgroup *memcg, 
long pages)
        free += page_counter_read(&memcg->dcache);
 
        /* assume file cache is reclaimable */
-       free += mem_cgroup_recursive_stat2(memcg, MEM_CGROUP_STAT_CACHE);
-
-       /* but do not count shmem pages as they can't be purged,
-        * only swapped out */
-       free -= mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_SHMEM);
+       free += page_counter_read(&memcg->cache);
 
        return free < pages ? -ENOMEM : 0;
 }
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to