Skip to contentSkip to conversation

Update the kmem_cache_create documentation regarding the name parameter

PATCH Applied Catalin Marinas 2 participants 2 messages Nov 21, 2008 – Nov 24, 2008 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update the kmem_cache_create documentation regarding the name parameter

kmem_cache implementations like slub are allowed to merge multiple caches but only the initial name is preserved. Therefore, kmem_cache_name() is not guaranteed to return the same pointer passed to the former function. This patch updates the documentation to make this clearer.

---
 mm/slab.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
mm/slab.c +2 -0
index 4887f1b..8924a03 100644
@@ -2124,6 +2124,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
  *
  * @name must be valid until the cache is destroyed. This implies that
  * the module calling this has to destroy the cache before getting unloaded.
+ * Note that kmem_cache_name() is not guaranteed to return the same pointer,
+ * therefore applications must manage it themselves.
  *
  * The flags are
  *
Applied
#1 lore raw

Hi Catalin,

Quoted 8 lines · Catalin Marinas

kmem_cache implementations like slub are allowed to merge multiple caches but only the initial name is preserved. Therefore, kmem_cache_name() is not guaranteed to return the same pointer passed to the former function. This patch updates the documentation to make this clearer.

Applied, thanks!

Quoted 18 lines
---
 mm/slab.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
mm/slab.c +2 -0
index 4887f1b..8924a03 100644
@@ -2124,6 +2124,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
  *
  * @name must be valid until the cache is destroyed. This implies that
  * the module calling this has to destroy the cache before getting unloaded.
+ * Note that kmem_cache_name() is not guaranteed to return the same pointer,
+ * therefore applications must manage it themselves.
  *
  * The flags are
  *