mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Slab allocators: Drop support for destructors
There is no user of destructors left. There is no reason why we should keep checking for destructors calls in the slab allocators. The RFC for this patch was discussed at http://marc.info/?l=linux-kernel&m=117882364330705&w=2 Destructors were mainly used for list management which required them to take a spinlock. Taking a spinlock in a destructor is a bit risky since the slab allocators may run the destructors anytime they decide a slab is no longer needed. Patch drops destructor support. Any attempt to use a destructor will BUG(). Acked-by: Pekka Enberg <[email protected]> Acked-by: Paul Mundt <[email protected]> Signed-off-by: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
afc0cedbe9
commit
c59def9f22
4 changed files with 16 additions and 62 deletions
|
|
@ -280,7 +280,6 @@ struct kmem_cache {
|
|||
unsigned long flags;
|
||||
const char *name;
|
||||
void (*ctor)(void *, struct kmem_cache *, unsigned long);
|
||||
void (*dtor)(void *, struct kmem_cache *, unsigned long);
|
||||
};
|
||||
|
||||
struct kmem_cache *kmem_cache_create(const char *name, size_t size,
|
||||
|
|
@ -296,13 +295,11 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
|
|||
c->name = name;
|
||||
c->size = size;
|
||||
if (flags & SLAB_DESTROY_BY_RCU) {
|
||||
BUG_ON(dtor);
|
||||
/* leave room for rcu footer at the end of object */
|
||||
c->size += sizeof(struct slob_rcu);
|
||||
}
|
||||
c->flags = flags;
|
||||
c->ctor = ctor;
|
||||
c->dtor = dtor;
|
||||
/* ignore alignment unless it's forced */
|
||||
c->align = (flags & SLAB_HWCACHE_ALIGN) ? SLOB_ALIGN : 0;
|
||||
if (c->align < align)
|
||||
|
|
@ -371,8 +368,6 @@ void kmem_cache_free(struct kmem_cache *c, void *b)
|
|||
slob_rcu->size = c->size;
|
||||
call_rcu(&slob_rcu->head, kmem_rcu_free);
|
||||
} else {
|
||||
if (c->dtor)
|
||||
c->dtor(b, c, 0);
|
||||
__kmem_cache_free(b, c->size);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue