Thread (20 messages) 20 messages, 3 authors, 2014-09-29

Re: [PATCH 3/3] mm/slab: support slab merge

From: Joonsoo Kim <hidden>
Date: 2014-08-26 02:26:38
Also in: lkml

On Mon, Aug 25, 2014 at 10:29:19AM -0500, Christoph Lameter wrote:
On Thu, 21 Aug 2014, Joonsoo Kim wrote:
quoted
diff --git a/mm/slab.c b/mm/slab.c
index 09b060e..a1cc1c9 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2052,6 +2052,26 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp)
 	return 0;
 }

+unsigned long kmem_cache_flags(unsigned long object_size,
+	unsigned long flags, const char *name,
+	void (*ctor)(void *))
+{
+	return flags;
+}
+
+struct kmem_cache *
+__kmem_cache_alias(const char *name, size_t size, size_t align,
+		   unsigned long flags, void (*ctor)(void *))
+{
+	struct kmem_cache *cachep;
+
+	cachep = find_mergeable(size, align, flags, name, ctor);
+	if (cachep)
+		cachep->refcount++;
+
+	return cachep;
+}
+
These could be commonized as well. Make refcount a common field and then
the same function can be used for both caches.
refcount is already common field. These can't be commonized, because
SLUB need some other SLUB specific processing related to debug flags
and object size change.

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help