diff options
author | Ganesh Mahendran <opensource.ganesh@gmail.com> | 2014-12-12 19:57:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-13 15:42:50 -0500 |
commit | 181366561ac1e1a7bc3b91dbe45e7614a2f758b9 (patch) | |
tree | 559d989501ca9e8735518a5ae6b7267ea24a5df3 | |
parent | df8b5bb998f10cfc040ad30300f9a9ea4592ff82 (diff) |
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: Ganesh Mahendran <opensource.ganesh@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/zsmalloc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 2021df5eb891..4d0a063145ec 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c | |||
@@ -979,12 +979,11 @@ static bool can_merge(struct size_class *prev, int size, int pages_per_zspage) | |||
979 | */ | 979 | */ |
980 | struct zs_pool *zs_create_pool(gfp_t flags) | 980 | struct zs_pool *zs_create_pool(gfp_t flags) |
981 | { | 981 | { |
982 | int i, ovhd_size; | 982 | int i; |
983 | struct zs_pool *pool; | 983 | struct zs_pool *pool; |
984 | struct size_class *prev_class = NULL; | 984 | struct size_class *prev_class = NULL; |
985 | 985 | ||
986 | ovhd_size = roundup(sizeof(*pool), PAGE_SIZE); | 986 | pool = kzalloc(sizeof(*pool), GFP_KERNEL); |
987 | pool = kzalloc(ovhd_size, GFP_KERNEL); | ||
988 | if (!pool) | 987 | if (!pool) |
989 | return NULL; | 988 | return NULL; |
990 | 989 | ||