Skip to contentSkip to conversation

mm,z3fold: use xx_zalloc instead xx_alloc and memset

PATCH Applied Hui Su 1 participant 1 message Sep 26, 2020 Memory management

lore
Share & tools
lore

Hui Su

author
#0 lore raw

PATCH 1/1 mm,z3fold: use xx_zalloc instead xx_alloc and memset

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

---
 mm/z3fold.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/z3fold.c +1 -2
index 460b0feced26..18feaa0bc537 100644
@@ -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);
 	}
Signature · 1 line
2.25.1