Kernel commit d42f3245c7e2 ("mm: memcg: convert vmstat slab counters to
bytes"), which is contained in linux v5.9-rc1 and later kernels, renamed
NR_SLAB_{RECLAIMABLE,UNRECLAIMABLE} to NR_SLAB_{RECLAIMABLE,UNRECLAIMABLE}_B.
Without the patch, "kmem -i" command will display incorrect SLAB
statistics:
crash> kmem -i | grep -e PAGES -e SLAB
PAGES TOTAL PERCENTAGE
SLAB 89458 349.4 MB 0% of TOTAL MEM
^^^^^ ^^^^^
With the patch, the actual result is:
crash> kmem -i | grep -e PAGES -e SLAB
PAGES TOTAL PERCENTAGE
SLAB 261953 1023.3 MB 0% of TOTAL MEM
Reported-by: Buland Kumar Singh <bsingh(a)redhat.com>
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
memory.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/memory.c b/memory.c
index 9d003713534b..a8f08f1a4d09 100644
--- a/memory.c
+++ b/memory.c
@@ -8382,9 +8382,11 @@ dump_kmeminfo(void)
if (vm_stat_init()) {
if (dump_vm_stat("NR_SLAB", &nr_slab, 0))
get_slabs = nr_slab;
- else if (dump_vm_stat("NR_SLAB_RECLAIMABLE", &nr_slab, 0)) {
+ else if (dump_vm_stat("NR_SLAB_RECLAIMABLE", &nr_slab, 0) ||
+ dump_vm_stat("NR_SLAB_RECLAIMABLE_B", &nr_slab, 0)) {
get_slabs = nr_slab;
- if (dump_vm_stat("NR_SLAB_UNRECLAIMABLE", &nr_slab, 0))
+ if (dump_vm_stat("NR_SLAB_UNRECLAIMABLE", &nr_slab, 0) ||
+ dump_vm_stat("NR_SLAB_UNRECLAIMABLE_B", &nr_slab, 0))
get_slabs += nr_slab;
}
}
--
2.37.1