summaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2012-06-13 10:24:57 -0500
committerPekka Enberg <penberg@kernel.org>2012-06-14 09:20:16 +0300
commit3b0efdfa1e719303536c04d9abca43abeb40f80a (patch)
tree6a429eebb3febe5cc2101615ec7c7ea4d10fd97b /mm/slob.c
parent350260889b251821e770573dfd65cd851b4ef781 (diff)
downloadlinux-stable-3b0efdfa1e719303536c04d9abca43abeb40f80a.tar.gz
linux-stable-3b0efdfa1e719303536c04d9abca43abeb40f80a.tar.bz2
linux-stable-3b0efdfa1e719303536c04d9abca43abeb40f80a.zip
mm, sl[aou]b: Extract common fields from struct kmem_cache
Define a struct that describes common fields used in all slab allocators. A slab allocator either uses the common definition (like SLOB) or is required to provide members of kmem_cache with the definition given. After that it will be possible to share code that only operates on those fields of kmem_cache. The patch basically takes the slob definition of kmem cache and uses the field namees for the other allocators. It also standardizes the names used for basic object lengths in allocators: object_size Struct size specified at kmem_cache_create. Basically the payload expected to be used by the subsystem. size The size of memory allocator for each object. This size is larger than object_size and includes padding, alignment and extra metadata for each object (f.e. for debugging and rcu). Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/mm/slob.c b/mm/slob.c
index c85265d22e08..95d1c7dd88e0 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -506,13 +506,6 @@ size_t ksize(const void *block)
}
EXPORT_SYMBOL(ksize);
-struct kmem_cache {
- unsigned int size, align;
- unsigned long flags;
- const char *name;
- void (*ctor)(void *);
-};
-
struct kmem_cache *kmem_cache_create(const char *name, size_t size,
size_t align, unsigned long flags, void (*ctor)(void *))
{
@@ -523,7 +516,7 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
if (c) {
c->name = name;
- c->size = size;
+ c->size = c->object_size;
if (flags & SLAB_DESTROY_BY_RCU) {
/* leave room for rcu footer at the end of object */
c->size += sizeof(struct slob_rcu);