aboutsummaryrefslogtreecommitdiffstats
path: root/mm/zsmalloc.c
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2016-07-26 18:24:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-07-26 19:19:19 -0400
commit91537fee001361b1a4d485f1af65d8efa03d49b5 (patch)
treebbfbe678ebbcdec6dc05de246970712cfdd653ba /mm/zsmalloc.c
parent8ea1d2a1985a7ae096edf5850a31d844ad1b8e97 (diff)
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. [minchan@kernel.org: zsmalloc: follow up zsmalloc vmstat] Link: http://lkml.kernel.org/r/20160607091737.GC23435@bbox [akpm@linux-foundation.org: fix build with CONFIG_ZSMALLOC=m] Link: http://lkml.kernel.org/r/1464919731-13255-1-git-send-email-minchan@kernel.org Signed-off-by: Minchan Kim <minchan@kernel.org> Cc: Sangseok Lee <sangseok.lee@lge.com> Cc: Chanho Min <chanho.min@lge.com> Cc: Chan Gyun Jeong <chan.jeong@lge.com> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/zsmalloc.c')
-rw-r--r--mm/zsmalloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 6b6986a02aa0..e4e8081b160b 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1007,6 +1007,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class,
1007 next = get_next_page(page); 1007 next = get_next_page(page);
1008 reset_page(page); 1008 reset_page(page);
1009 unlock_page(page); 1009 unlock_page(page);
1010 dec_zone_page_state(page, NR_ZSPAGES);
1010 put_page(page); 1011 put_page(page);
1011 page = next; 1012 page = next;
1012 } while (page != NULL); 1013 } while (page != NULL);
@@ -1137,11 +1138,15 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
1137 1138
1138 page = alloc_page(gfp); 1139 page = alloc_page(gfp);
1139 if (!page) { 1140 if (!page) {
1140 while (--i >= 0) 1141 while (--i >= 0) {
1142 dec_zone_page_state(pages[i], NR_ZSPAGES);
1141 __free_page(pages[i]); 1143 __free_page(pages[i]);
1144 }
1142 cache_free_zspage(pool, zspage); 1145 cache_free_zspage(pool, zspage);
1143 return NULL; 1146 return NULL;
1144 } 1147 }
1148
1149 inc_zone_page_state(page, NR_ZSPAGES);
1145 pages[i] = page; 1150 pages[i] = page;
1146 } 1151 }
1147 1152