* [RFC PATCH] mm/zsmalloc: allocate exactly size of struct zs_pool
@ 2014-11-29 11:23 Ganesh Mahendran
2014-12-01 0:29 ` Minchan Kim
0 siblings, 1 reply; 2+ messages in thread
From: Ganesh Mahendran @ 2014-11-29 11:23 UTC (permalink / raw)
To: minchan, ngupta, ddstreet; +Cc: akpm, linux-mm, linux-kernel, Ganesh Mahendran
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>
---
mm/zsmalloc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2021df5..4d0a063 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;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC PATCH] mm/zsmalloc: allocate exactly size of struct zs_pool
2014-11-29 11:23 [RFC PATCH] mm/zsmalloc: allocate exactly size of struct zs_pool Ganesh Mahendran
@ 2014-12-01 0:29 ` Minchan Kim
0 siblings, 0 replies; 2+ messages in thread
From: Minchan Kim @ 2014-12-01 0:29 UTC (permalink / raw)
To: Ganesh Mahendran; +Cc: ngupta, ddstreet, akpm, linux-mm, linux-kernel
On Sat, Nov 29, 2014 at 07:23:55PM +0800, Ganesh Mahendran wrote:
> 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>
--
Kind regards,
Minchan Kim
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-01 0:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-29 11:23 [RFC PATCH] mm/zsmalloc: allocate exactly size of struct zs_pool Ganesh Mahendran
2014-12-01 0:29 ` Minchan Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).