[RFC PATCH v2 2/3] mm: zsmalloc: include zs page size in meminfo extra

From: Jaewon Kim
Date: Mon Mar 23 2020 - 04:05:24 EST


On most of recent Android device use DRAM memory based compressed swap
to save free memory. And the swap device size is also big enough.

The zsmalloc page size is alread shown on vmstat by commit 91537fee0013
("mm: add NR_ZSMALLOC to vmstat"). If the size is also shown in
/proc/meminfo_extra, it will be better to see system wide memory usage at a
glance.

To include heap size, use register_meminfo_extra introduced in previous
patch.

i.e) cat /proc/meminfo_extra | grep ZsPages
IonSystemHeap: 242620 kB
ZsPages: 203860 kB

i.e.) show_mem on oom
<6>[ 420.856428] Mem-Info:
<6>[ 420.856433] ZsPages:44114kB

Signed-off-by: Jaewon Kim <jaewon31.kim@xxxxxxxxxxx>
---
mm/zsmalloc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 22d17ecfe7df..9d5682aa44ac 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2566,6 +2566,7 @@ static int __init zs_init(void)

zs_stat_init();

+ register_meminfo_extra(&vm_zone_stat[NR_ZSPAGES], 0, "ZsPages");
return 0;

hp_setup_fail:
@@ -2583,6 +2584,7 @@ static void __exit zs_exit(void)
cpuhp_remove_state(CPUHP_MM_ZS_PREPARE);

zs_stat_exit();
+ unregister_meminfo_extra(&vm_zone_stat[NR_ZSPAGES]);
}

module_init(zs_init);
--
2.13.7