summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorGanesh Mahendran <opensource.ganesh@gmail.com>2014-12-12 16:57:10 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 12:42:50 -0800
commit181366561ac1e1a7bc3b91dbe45e7614a2f758b9 (patch)
tree559d989501ca9e8735518a5ae6b7267ea24a5df3 /mm
parentdf8b5bb998f10cfc040ad30300f9a9ea4592ff82 (diff)
downloadlinux-181366561ac1e1a7bc3b91dbe45e7614a2f758b9.tar.bz2
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/zsmalloc.c5
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)
*/
struct zs_pool *zs_create_pool(gfp_t flags)
{
- int i, ovhd_size;
+ int i;
struct zs_pool *pool;
struct size_class *prev_class = NULL;
- ovhd_size = roundup(sizeof(*pool), PAGE_SIZE);
- pool = kzalloc(ovhd_size, GFP_KERNEL);
+ pool = kzalloc(sizeof(*pool), GFP_KERNEL);
if (!pool)
return NULL;