diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-07-25 22:45:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:07 -0400 |
commit | 51cc50685a4275c6a02653670af9f108a64e01cf (patch) | |
tree | 819d47bd2b0c8a9d1835d863853804b0a0242b97 /mm/slab.c | |
parent | d91958815d214ea365b98cbff6215383897edcb6 (diff) |
SL*B: drop kmem cache argument from constructor
Kmem cache passed to constructor is only needed for constructors that are
themselves multiplexeres. Nobody uses this "feature", nor does anybody uses
passed kmem cache in non-trivial way, so pass only pointer to object.
Non-trivial places are:
arch/powerpc/mm/init_64.c
arch/powerpc/mm/hugetlbpage.c
This is flag day, yes.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Jon Tollefson <kniht@linux.vnet.ibm.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Matt Mackall <mpm@selenic.com>
[akpm@linux-foundation.org: fix arch/powerpc/mm/hugetlbpage.c]
[akpm@linux-foundation.org: fix mm/slab.c]
[akpm@linux-foundation.org: fix ubifs]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -406,7 +406,7 @@ struct kmem_cache { | |||
406 | unsigned int dflags; /* dynamic flags */ | 406 | unsigned int dflags; /* dynamic flags */ |
407 | 407 | ||
408 | /* constructor func */ | 408 | /* constructor func */ |
409 | void (*ctor)(struct kmem_cache *, void *); | 409 | void (*ctor)(void *obj); |
410 | 410 | ||
411 | /* 5) cache creation/removal */ | 411 | /* 5) cache creation/removal */ |
412 | const char *name; | 412 | const char *name; |
@@ -2137,8 +2137,7 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep) | |||
2137 | */ | 2137 | */ |
2138 | struct kmem_cache * | 2138 | struct kmem_cache * |
2139 | kmem_cache_create (const char *name, size_t size, size_t align, | 2139 | kmem_cache_create (const char *name, size_t size, size_t align, |
2140 | unsigned long flags, | 2140 | unsigned long flags, void (*ctor)(void *)) |
2141 | void (*ctor)(struct kmem_cache *, void *)) | ||
2142 | { | 2141 | { |
2143 | size_t left_over, slab_size, ralign; | 2142 | size_t left_over, slab_size, ralign; |
2144 | struct kmem_cache *cachep = NULL, *pc; | 2143 | struct kmem_cache *cachep = NULL, *pc; |
@@ -2653,7 +2652,7 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2653 | * They must also be threaded. | 2652 | * They must also be threaded. |
2654 | */ | 2653 | */ |
2655 | if (cachep->ctor && !(cachep->flags & SLAB_POISON)) | 2654 | if (cachep->ctor && !(cachep->flags & SLAB_POISON)) |
2656 | cachep->ctor(cachep, objp + obj_offset(cachep)); | 2655 | cachep->ctor(objp + obj_offset(cachep)); |
2657 | 2656 | ||
2658 | if (cachep->flags & SLAB_RED_ZONE) { | 2657 | if (cachep->flags & SLAB_RED_ZONE) { |
2659 | if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) | 2658 | if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) |
@@ -2669,7 +2668,7 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2669 | cachep->buffer_size / PAGE_SIZE, 0); | 2668 | cachep->buffer_size / PAGE_SIZE, 0); |
2670 | #else | 2669 | #else |
2671 | if (cachep->ctor) | 2670 | if (cachep->ctor) |
2672 | cachep->ctor(cachep, objp); | 2671 | cachep->ctor(objp); |
2673 | #endif | 2672 | #endif |
2674 | slab_bufctl(slabp)[i] = i + 1; | 2673 | slab_bufctl(slabp)[i] = i + 1; |
2675 | } | 2674 | } |
@@ -3093,7 +3092,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
3093 | #endif | 3092 | #endif |
3094 | objp += obj_offset(cachep); | 3093 | objp += obj_offset(cachep); |
3095 | if (cachep->ctor && cachep->flags & SLAB_POISON) | 3094 | if (cachep->ctor && cachep->flags & SLAB_POISON) |
3096 | cachep->ctor(cachep, objp); | 3095 | cachep->ctor(objp); |
3097 | #if ARCH_SLAB_MINALIGN | 3096 | #if ARCH_SLAB_MINALIGN |
3098 | if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { | 3097 | if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { |
3099 | printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", | 3098 | printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", |