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>
This commit is contained in:
committed by
Linus Torvalds
parent
d91958815d
commit
51cc50685a
11
mm/slab.c
11
mm/slab.c
@ -406,7 +406,7 @@ struct kmem_cache {
|
||||
unsigned int dflags; /* dynamic flags */
|
||||
|
||||
/* constructor func */
|
||||
void (*ctor)(struct kmem_cache *, void *);
|
||||
void (*ctor)(void *obj);
|
||||
|
||||
/* 5) cache creation/removal */
|
||||
const char *name;
|
||||
@ -2137,8 +2137,7 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
|
||||
*/
|
||||
struct kmem_cache *
|
||||
kmem_cache_create (const char *name, size_t size, size_t align,
|
||||
unsigned long flags,
|
||||
void (*ctor)(struct kmem_cache *, void *))
|
||||
unsigned long flags, void (*ctor)(void *))
|
||||
{
|
||||
size_t left_over, slab_size, ralign;
|
||||
struct kmem_cache *cachep = NULL, *pc;
|
||||
@ -2653,7 +2652,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
|
||||
* They must also be threaded.
|
||||
*/
|
||||
if (cachep->ctor && !(cachep->flags & SLAB_POISON))
|
||||
cachep->ctor(cachep, objp + obj_offset(cachep));
|
||||
cachep->ctor(objp + obj_offset(cachep));
|
||||
|
||||
if (cachep->flags & SLAB_RED_ZONE) {
|
||||
if (*dbg_redzone2(cachep, objp) != RED_INACTIVE)
|
||||
@ -2669,7 +2668,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
|
||||
cachep->buffer_size / PAGE_SIZE, 0);
|
||||
#else
|
||||
if (cachep->ctor)
|
||||
cachep->ctor(cachep, objp);
|
||||
cachep->ctor(objp);
|
||||
#endif
|
||||
slab_bufctl(slabp)[i] = i + 1;
|
||||
}
|
||||
@ -3093,7 +3092,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
|
||||
#endif
|
||||
objp += obj_offset(cachep);
|
||||
if (cachep->ctor && cachep->flags & SLAB_POISON)
|
||||
cachep->ctor(cachep, objp);
|
||||
cachep->ctor(objp);
|
||||
#if ARCH_SLAB_MINALIGN
|
||||
if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) {
|
||||
printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n",
|
||||
|
Reference in New Issue
Block a user