The values of NR_SLAB_RECLAIMABLE_B and NR_SLAB_UNRECLAIMABLE_B counters are in bytes rather than in pages. So, one should not multiply them by PAGE_SIZE when preparing the records for 'memory.stat' files in the memory cgroups.
This also applies to 'total_slab_[un]reclaimable' stats in those files. https://jira.sw.ru/browse/PSBM-132728 Fixes: cf89dfa06ebe ("mm: memcontrol: add stats for reclaimable and unreclaimable stats") Signed-off-by: Evgenii Shatokhin <[email protected]> --- mm/memcontrol.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 989dc23d05b8..3f6f59ac8746 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4727,7 +4727,9 @@ static int memcg_stat_show(struct seq_file *m, void *v) if (memcg1_stats[i] == NR_ANON_THPS) nr *= HPAGE_PMD_NR; #endif - seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr * PAGE_SIZE); + if (!vmstat_item_in_bytes(memcg1_stats[i])) + nr *= PAGE_SIZE; + seq_printf(m, "%s %lu\n", memcg1_stat_names[i], nr); } for (i = 0; i < ARRAY_SIZE(memcg1_events); i++) @@ -4767,17 +4769,18 @@ static int memcg_stat_show(struct seq_file *m, void *v) (u64)memsw * PAGE_SIZE); for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) { - unsigned long nr; + u64 nr; if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) continue; - nr = memcg_page_state(memcg, memcg1_stats[i]); + nr = (u64)memcg_page_state(memcg, memcg1_stats[i]); #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (memcg1_stats[i] == NR_ANON_THPS) nr *= HPAGE_PMD_NR; #endif - seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i], - (u64)nr * PAGE_SIZE); + if (!vmstat_item_in_bytes(memcg1_stats[i])) + nr *= PAGE_SIZE; + seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i], nr); } for (i = 0; i < ARRAY_SIZE(memcg1_events); i++) -- 2.30.2 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
