Commit 91537fee authored by Minchan Kim's avatar Minchan Kim Committed by Linus Torvalds
Browse files

mm: add NR_ZSMALLOC to vmstat

zram is very popular for some of the embedded world (e.g., TV, mobile
phones).  On those system, zsmalloc's consumed memory size is never
trivial (one of example from real product system, total memory: 800M,
zsmalloc consumed: 150M), so we have used this out of tree patch to
monitor system memory behavior via /proc/vmstat.

With zsmalloc in vmstat, it helps in tracking down system behavior due
to memory usage.

[ zsmalloc: follow up zsmalloc vmstat]
[ fix build with CONFIG_ZSMALLOC=m]

Signed-off-by: default avatarMinchan Kim <>
Cc: Sangseok Lee <>
Cc: Chanho Min <>
Cc: Chan Gyun Jeong <>
Cc: Sergey Senozhatsky <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 8ea1d2a1
......@@ -140,6 +140,9 @@ enum zone_stat_item {
NR_DIRTIED, /* page dirtyings since bootup */
NR_WRITTEN, /* page writings since bootup */
NR_PAGES_SCANNED, /* pages scanned since last reclaim */
NR_ZSPAGES, /* allocated in zsmalloc */
NUMA_HIT, /* allocated in intended node */
NUMA_MISS, /* allocated in non intended node */
......@@ -718,7 +718,9 @@ const char * const vmstat_text[] = {
......@@ -1007,6 +1007,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class,
next = get_next_page(page);
dec_zone_page_state(page, NR_ZSPAGES);
page = next;
} while (page != NULL);
......@@ -1137,11 +1138,15 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
page = alloc_page(gfp);
if (!page) {
while (--i >= 0)
while (--i >= 0) {
dec_zone_page_state(pages[i], NR_ZSPAGES);
cache_free_zspage(pool, zspage);
return NULL;
inc_zone_page_state(page, NR_ZSPAGES);
pages[i] = page;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment