Commit 18136656 authored by Ganesh Mahendran's avatar Ganesh Mahendran Committed by Linus Torvalds

mm/zsmalloc: allocate exactly size of struct zs_pool

In zs_create_pool(), we allocate memory more then sizeof(struct zs_pool)
  ovhd_size = roundup(sizeof(*pool), PAGE_SIZE);

This patch allocate memory of exactly needed size.
Signed-off-by: default avatarGanesh Mahendran <opensource.ganesh@gmail.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent df8b5bb9
...@@ -979,12 +979,11 @@ static bool can_merge(struct size_class *prev, int size, int pages_per_zspage) ...@@ -979,12 +979,11 @@ static bool can_merge(struct size_class *prev, int size, int pages_per_zspage)
*/ */
struct zs_pool *zs_create_pool(gfp_t flags) struct zs_pool *zs_create_pool(gfp_t flags)
{ {
int i, ovhd_size; int i;
struct zs_pool *pool; struct zs_pool *pool;
struct size_class *prev_class = NULL; struct size_class *prev_class = NULL;
ovhd_size = roundup(sizeof(*pool), PAGE_SIZE); pool = kzalloc(sizeof(*pool), GFP_KERNEL);
pool = kzalloc(ovhd_size, GFP_KERNEL);
if (!pool) if (!pool)
return NULL; return NULL;
......
Markdown is supported
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