linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm,z3fold: use xx_zalloc instead xx_alloc and memset
@ 2020-09-26 10:08 Hui Su
  0 siblings, 0 replies; only message in thread
From: Hui Su @ 2020-09-26 10:08 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel

alloc_slots() allocate memory for slots by kmem_cache_alloc(),
then memset it, we can just use kmem_cache_zalloc() api.

Signed-off-by: Hui Su <sh_def@163.com>
---
 mm/z3fold.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index 460b0feced26..18feaa0bc537 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -212,13 +212,12 @@ static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
 {
 	struct z3fold_buddy_slots *slots;
 
-	slots = kmem_cache_alloc(pool->c_handle,
+	slots = kmem_cache_zalloc(pool->c_handle,
 				 (gfp & ~(__GFP_HIGHMEM | __GFP_MOVABLE)));
 
 	if (slots) {
 		/* It will be freed separately in free_handle(). */
 		kmemleak_not_leak(slots);
-		memset(slots->slot, 0, sizeof(slots->slot));
 		slots->pool = (unsigned long)pool;
 		rwlock_init(&slots->lock);
 	}
-- 
2.25.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-26 10:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-26 10:08 [PATCH] mm,z3fold: use xx_zalloc instead xx_alloc and memset Hui Su

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).