aboutsummaryrefslogtreecommitdiffstats
path: root/mm/zsmalloc.c
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2014-10-09 18:29:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:26:02 -0400
commit722cdc17232f0f684011407f7cf3c40d39457971 (patch)
tree98c3cdca13c1edc8017bee617f3345e337ae3aea /mm/zsmalloc.c
parent13de8933c96b4557f667c337676f05274e017f83 (diff)
zsmalloc: change return value unit of zs_get_total_size_bytes
zs_get_total_size_bytes returns a amount of memory zsmalloc consumed with *byte unit* but zsmalloc operates *page unit* rather than byte unit so let's change the API so benefit we could get is that reduce unnecessary overhead (ie, change page unit with byte unit) in zsmalloc. Since return type is pages, "zs_get_total_pages" is better than "zs_get_total_size_bytes". Signed-off-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Dan Streetman <ddstreet@ieee.org> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: <juno.choi@lge.com> Cc: <seungho1.park@lge.com> Cc: Luigi Semenzato <semenzato@google.com> Cc: Nitin Gupta <ngupta@vflare.org> Cc: Seth Jennings <sjennings@variantweb.net> Cc: David Horner <ds2horner@gmail.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.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.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2a4acf400846..c4a91578dc96 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -297,7 +297,7 @@ static void zs_zpool_unmap(void *pool, unsigned long handle)
297 297
298static u64 zs_zpool_total_size(void *pool) 298static u64 zs_zpool_total_size(void *pool)
299{ 299{
300 return zs_get_total_size_bytes(pool); 300 return zs_get_total_pages(pool) << PAGE_SHIFT;
301} 301}
302 302
303static struct zpool_driver zs_zpool_driver = { 303static struct zpool_driver zs_zpool_driver = {
@@ -1181,12 +1181,11 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle)
1181} 1181}
1182EXPORT_SYMBOL_GPL(zs_unmap_object); 1182EXPORT_SYMBOL_GPL(zs_unmap_object);
1183 1183
1184u64 zs_get_total_size_bytes(struct zs_pool *pool) 1184unsigned long zs_get_total_pages(struct zs_pool *pool)
1185{ 1185{
1186 u64 npages = atomic_long_read(&pool->pages_allocated); 1186 return atomic_long_read(&pool->pages_allocated);
1187 return npages << PAGE_SHIFT;
1188} 1187}
1189EXPORT_SYMBOL_GPL(zs_get_total_size_bytes); 1188EXPORT_SYMBOL_GPL(zs_get_total_pages);
1190 1189
1191module_init(zs_init); 1190module_init(zs_init);
1192module_exit(zs_exit); 1191module_exit(zs_exit);