linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] mm:slab:use kmem_cache_free() to free
@ 2024-08-22  2:27 Yan Zhen
  2024-08-22 16:59 ` Christoph Lameter (Ampere)
  2024-08-27 15:54 ` [PATCH] mm: slab: use " Markus Elfring
  0 siblings, 2 replies; 5+ messages in thread
From: Yan Zhen @ 2024-08-22  2:27 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm, vbabka
  Cc: roman.gushchin, 42.hyeyoo, linux-mm, linux-kernel,
	opensource.kernel, Yan Zhen

The kmem_cache_alloc() is typically used to free memory allocated through 
the kernel memory cache (slab allocator). 

Using kmem_cache_free() for deallocation may be more reasonable.

Signed-off-by: Yan Zhen <yanzhen@vivo.com>
---
 mm/slab_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index da1b00665..0463df45e 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -491,7 +491,7 @@ kmem_buckets *kmem_buckets_create(const char *name, slab_flags_t flags,
 fail:
 	for (idx = 0; idx < ARRAY_SIZE(kmalloc_caches[KMALLOC_NORMAL]); idx++)
 		kmem_cache_destroy((*b)[idx]);
-	kfree(b);
+	kmem_cache_free(kmem_buckets_cache, b);
 
 	return NULL;
 }
-- 
2.34.1



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

end of thread, other threads:[~2024-08-27 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-22  2:27 [PATCH v1] mm:slab:use kmem_cache_free() to free Yan Zhen
2024-08-22 16:59 ` Christoph Lameter (Ampere)
2024-08-27 14:49   ` Vlastimil Babka
2024-08-27 14:57     ` Vlastimil Babka
2024-08-27 15:54 ` [PATCH] mm: slab: use " Markus Elfring

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