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

From: Jaewon Kim
Date: Tue Mar 10 2020 - 23:45:09 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, it will be better to see system wide memory usage at a
glance.

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

i.e) cat /proc/meminfo | 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..9e45d7e0cd69 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2566,6 +2566,7 @@ static int __init zs_init(void)

zs_stat_init();

+ register_extra_meminfo(&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_extra_meminfo(&vm_zone_stat[NR_ZSPAGES]);
}

module_init(zs_init);
--
2.13.7