linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/zsmalloc.c: Convert to use kmem_cache_zalloc in cache_alloc_zspage()
@ 2021-01-14 12:00 Miaohe Lin
  2021-01-14 12:06 ` Sergey Senozhatsky
  0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2021-01-14 12:00 UTC (permalink / raw)
  To: akpm, minchan, ngupta, sergey.senozhatsky.work
  Cc: linux-mm, linux-kernel, linmiaohe

We always memset the zspage allocated via cache_alloc_zspage. So it's more
convenient to use kmem_cache_zalloc in cache_alloc_zspage than caller do it
manually.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/zsmalloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 7289f502ffac..cf0ed0e4e911 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -357,7 +357,7 @@ static void cache_free_handle(struct zs_pool *pool, unsigned long handle)
 
 static struct zspage *cache_alloc_zspage(struct zs_pool *pool, gfp_t flags)
 {
-	return kmem_cache_alloc(pool->zspage_cachep,
+	return kmem_cache_zalloc(pool->zspage_cachep,
 			flags & ~(__GFP_HIGHMEM|__GFP_MOVABLE));
 }
 
@@ -1064,7 +1064,6 @@ static struct zspage *alloc_zspage(struct zs_pool *pool,
 	if (!zspage)
 		return NULL;
 
-	memset(zspage, 0, sizeof(struct zspage));
 	zspage->magic = ZSPAGE_MAGIC;
 	migrate_lock_init(zspage);
 
-- 
2.19.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/zsmalloc.c: Convert to use kmem_cache_zalloc in cache_alloc_zspage()
  2021-01-14 12:00 [PATCH] mm/zsmalloc.c: Convert to use kmem_cache_zalloc in cache_alloc_zspage() Miaohe Lin
@ 2021-01-14 12:06 ` Sergey Senozhatsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2021-01-14 12:06 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: akpm, minchan, ngupta, sergey.senozhatsky.work, linux-mm, linux-kernel

On (21/01/14 07:00), Miaohe Lin wrote:
>
> We always memset the zspage allocated via cache_alloc_zspage. So it's more
> convenient to use kmem_cache_zalloc in cache_alloc_zspage than caller do it
> manually.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-14 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 12:00 [PATCH] mm/zsmalloc.c: Convert to use kmem_cache_zalloc in cache_alloc_zspage() Miaohe Lin
2021-01-14 12:06 ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox