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 <[email protected]>
Reviewed-by: Dan Streetman <[email protected]>
Cc: Sergey Senozhatsky <[email protected]>
Cc: Jerome Marchand <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: Luigi Semenzato <[email protected]>
Cc: Nitin Gupta <[email protected]>
Cc: Seth Jennings <[email protected]>
Cc: David Horner <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Minchan Kim 2014-10-09 15:29:50 -07:00 • committed by Linus Torvalds
commit 722cdc1723
3 changed files with 7 additions and 8 deletions

View file

@ -103,10 +103,10 @@ static ssize_t mem_used_total_show(struct device *dev,
down_read(&zram->init_lock);
if (init_done(zram))
val = zs_get_total_size_bytes(meta->mem_pool);
val = zs_get_total_pages(meta->mem_pool);
up_read(&zram->init_lock);
return scnprintf(buf, PAGE_SIZE, "%llu\n", val);
return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT);
}
static ssize_t max_comp_streams_show(struct device *dev,