[Devel] [PATCH RHEL8 COMMIT] ve/mm/dcache: Honor changing per-memcg s[un]reclaimable counters to bytes in dcache min threshold

Konstantin Khorenko khorenko at virtuozzo.com
Wed Aug 18 20:56:17 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.7
------>
commit 3ab12bb5c723ff8ca8bf0bdc4a339df22cc231df
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Aug 18 13:48:01 2021 +0300

    ve/mm/dcache: Honor changing per-memcg s[un]reclaimable counters to bytes in dcache min threshold
    
    RHEL8.4 has following ms commit backported:
    d42f3245c7e2 ("mm: memcg: convert vmstat slab counters to bytes")
    
    So, update places were we use per-memcg counters NR_SLAB_[UN]RECLAIMABLE_B
    accordingly.
    
    https://jira.sw.ru/browse/PSBM-132893
    Fixes: 04a18280021f ("ve/mm: introduce min threshold for dcache")
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/super.c      | 2 +-
 mm/memcontrol.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 5b807bdb58e6..a68ab7d3e1b7 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -65,7 +65,7 @@ bool dcache_is_low(struct mem_cgroup *memcg)
 
 	anon = global_node_page_state(NR_ANON_MAPPED);
 	file = global_node_page_state(NR_FILE_PAGES);
-	dcache = global_node_page_state(NR_SLAB_RECLAIMABLE_B);
+	dcache = global_node_page_state_pages(NR_SLAB_RECLAIMABLE_B);
 
 	return dcache / vfs_cache_min_ratio <
 			(anon + file + dcache) / 100;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index cd12ec265c61..a1c9cb362b74 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1521,7 +1521,11 @@ bool mem_cgroup_dcache_is_low(struct mem_cgroup *memcg, int vfs_cache_min_ratio)
 
 	anon = memcg_page_state(memcg, NR_ANON_MAPPED);
 	file = memcg_page_state(memcg, NR_FILE_PAGES);
-	dcache = memcg_page_state(memcg, NR_SLAB_RECLAIMABLE_B);
+	/*
+	 * After ms commit d42f3245c7e2 ("mm: memcg: convert vmstat slab
+	 * counters to bytes") NR_SLAB_{,UN}RECLAIMABLE_B are in bytes.
+	 */
+	dcache = memcg_page_state(memcg, NR_SLAB_RECLAIMABLE_B) >> PAGE_SHIFT;
 
 	return dcache / vfs_cache_min_ratio <
 			(anon + file + dcache) / 100;


More information about the Devel mailing list