aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-07-19 21:11:58 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-07-19 21:11:58 -0400
commit20c2df83d25c6a95affe6157a4c9cac4cf5ffaac (patch)
tree415c4453d2b17a50abe7a3e515177e1fa337bd67 /mm
parent64fb98fc40738ae1a98bcea9ca3145b89fb71524 (diff)
mm: Remove slab destructors from kmem_cache_create().
Slab destructors were no longer supported after Christoph's c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been BUGs for both slab and slub, and slob never supported them either. This rips out support for the dtor pointer from kmem_cache_create() completely and fixes up every single callsite in the kernel (there were about 224, not including the slab allocator definitions themselves, or the documentation references). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mempolicy.c4
-rw-r--r--mm/rmap.c2
-rw-r--r--mm/shmem.c2
-rw-r--r--mm/slab.c17
-rw-r--r--mm/slob.c3
-rw-r--r--mm/slub.c4
6 files changed, 13 insertions, 19 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9f4e9b95e8f2..71b84b45154a 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1605,11 +1605,11 @@ void __init numa_policy_init(void)
1605 1605
1606 policy_cache = kmem_cache_create("numa_policy", 1606 policy_cache = kmem_cache_create("numa_policy",
1607 sizeof(struct mempolicy), 1607 sizeof(struct mempolicy),
1608 0, SLAB_PANIC, NULL, NULL); 1608 0, SLAB_PANIC, NULL);
1609 1609
1610 sn_cache = kmem_cache_create("shared_policy_node", 1610 sn_cache = kmem_cache_create("shared_policy_node",
1611 sizeof(struct sp_node), 1611 sizeof(struct sp_node),
1612 0, SLAB_PANIC, NULL, NULL); 1612 0, SLAB_PANIC, NULL);
1613 1613
1614 /* 1614 /*
1615 * Set interleaving policy for system init. Interleaving is only 1615 * Set interleaving policy for system init. Interleaving is only
diff --git a/mm/rmap.c b/mm/rmap.c
index fede5c7910be..41ac39749ef4 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -149,7 +149,7 @@ static void anon_vma_ctor(void *data, struct kmem_cache *cachep,
149void __init anon_vma_init(void) 149void __init anon_vma_init(void)
150{ 150{
151 anon_vma_cachep = kmem_cache_create("anon_vma", sizeof(struct anon_vma), 151 anon_vma_cachep = kmem_cache_create("anon_vma", sizeof(struct anon_vma),
152 0, SLAB_DESTROY_BY_RCU|SLAB_PANIC, anon_vma_ctor, NULL); 152 0, SLAB_DESTROY_BY_RCU|SLAB_PANIC, anon_vma_ctor);
153} 153}
154 154
155/* 155/*
diff --git a/mm/shmem.c b/mm/shmem.c
index ad155c7745dc..fcd19d323f9f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2322,7 +2322,7 @@ static int init_inodecache(void)
2322{ 2322{
2323 shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", 2323 shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
2324 sizeof(struct shmem_inode_info), 2324 sizeof(struct shmem_inode_info),
2325 0, 0, init_once, NULL); 2325 0, 0, init_once);
2326 if (shmem_inode_cachep == NULL) 2326 if (shmem_inode_cachep == NULL)
2327 return -ENOMEM; 2327 return -ENOMEM;
2328 return 0; 2328 return 0;
diff --git a/mm/slab.c b/mm/slab.c
index c3feeaab3875..bde271c001ba 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1484,7 +1484,7 @@ void __init kmem_cache_init(void)
1484 sizes[INDEX_AC].cs_size, 1484 sizes[INDEX_AC].cs_size,
1485 ARCH_KMALLOC_MINALIGN, 1485 ARCH_KMALLOC_MINALIGN,
1486 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1486 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1487 NULL, NULL); 1487 NULL);
1488 1488
1489 if (INDEX_AC != INDEX_L3) { 1489 if (INDEX_AC != INDEX_L3) {
1490 sizes[INDEX_L3].cs_cachep = 1490 sizes[INDEX_L3].cs_cachep =
@@ -1492,7 +1492,7 @@ void __init kmem_cache_init(void)
1492 sizes[INDEX_L3].cs_size, 1492 sizes[INDEX_L3].cs_size,
1493 ARCH_KMALLOC_MINALIGN, 1493 ARCH_KMALLOC_MINALIGN,
1494 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1494 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1495 NULL, NULL); 1495 NULL);
1496 } 1496 }
1497 1497
1498 slab_early_init = 0; 1498 slab_early_init = 0;
@@ -1510,7 +1510,7 @@ void __init kmem_cache_init(void)
1510 sizes->cs_size, 1510 sizes->cs_size,
1511 ARCH_KMALLOC_MINALIGN, 1511 ARCH_KMALLOC_MINALIGN,
1512 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1512 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1513 NULL, NULL); 1513 NULL);
1514 } 1514 }
1515#ifdef CONFIG_ZONE_DMA 1515#ifdef CONFIG_ZONE_DMA
1516 sizes->cs_dmacachep = kmem_cache_create( 1516 sizes->cs_dmacachep = kmem_cache_create(
@@ -1519,7 +1519,7 @@ void __init kmem_cache_init(void)
1519 ARCH_KMALLOC_MINALIGN, 1519 ARCH_KMALLOC_MINALIGN,
1520 ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA| 1520 ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA|
1521 SLAB_PANIC, 1521 SLAB_PANIC,
1522 NULL, NULL); 1522 NULL);
1523#endif 1523#endif
1524 sizes++; 1524 sizes++;
1525 names++; 1525 names++;
@@ -2101,12 +2101,10 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
2101 * @align: The required alignment for the objects. 2101 * @align: The required alignment for the objects.
2102 * @flags: SLAB flags 2102 * @flags: SLAB flags
2103 * @ctor: A constructor for the objects. 2103 * @ctor: A constructor for the objects.
2104 * @dtor: A destructor for the objects (not implemented anymore).
2105 * 2104 *
2106 * Returns a ptr to the cache on success, NULL on failure. 2105 * Returns a ptr to the cache on success, NULL on failure.
2107 * Cannot be called within a int, but can be interrupted. 2106 * Cannot be called within a int, but can be interrupted.
2108 * The @ctor is run when new pages are allocated by the cache 2107 * The @ctor is run when new pages are allocated by the cache.
2109 * and the @dtor is run before the pages are handed back.
2110 * 2108 *
2111 * @name must be valid until the cache is destroyed. This implies that 2109 * @name must be valid until the cache is destroyed. This implies that
2112 * the module calling this has to destroy the cache before getting unloaded. 2110 * the module calling this has to destroy the cache before getting unloaded.
@@ -2126,8 +2124,7 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
2126struct kmem_cache * 2124struct kmem_cache *
2127kmem_cache_create (const char *name, size_t size, size_t align, 2125kmem_cache_create (const char *name, size_t size, size_t align,
2128 unsigned long flags, 2126 unsigned long flags,
2129 void (*ctor)(void*, struct kmem_cache *, unsigned long), 2127 void (*ctor)(void*, struct kmem_cache *, unsigned long))
2130 void (*dtor)(void*, struct kmem_cache *, unsigned long))
2131{ 2128{
2132 size_t left_over, slab_size, ralign; 2129 size_t left_over, slab_size, ralign;
2133 struct kmem_cache *cachep = NULL, *pc; 2130 struct kmem_cache *cachep = NULL, *pc;
@@ -2136,7 +2133,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2136 * Sanity checks... these are all serious usage bugs. 2133 * Sanity checks... these are all serious usage bugs.
2137 */ 2134 */
2138 if (!name || in_interrupt() || (size < BYTES_PER_WORD) || 2135 if (!name || in_interrupt() || (size < BYTES_PER_WORD) ||
2139 size > KMALLOC_MAX_SIZE || dtor) { 2136 size > KMALLOC_MAX_SIZE) {
2140 printk(KERN_ERR "%s: Early error in slab %s\n", __FUNCTION__, 2137 printk(KERN_ERR "%s: Early error in slab %s\n", __FUNCTION__,
2141 name); 2138 name);
2142 BUG(); 2139 BUG();
diff --git a/mm/slob.c b/mm/slob.c
index c89ef116d7aa..d50920ecc02b 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -492,8 +492,7 @@ struct kmem_cache {
492 492
493struct kmem_cache *kmem_cache_create(const char *name, size_t size, 493struct kmem_cache *kmem_cache_create(const char *name, size_t size,
494 size_t align, unsigned long flags, 494 size_t align, unsigned long flags,
495 void (*ctor)(void*, struct kmem_cache *, unsigned long), 495 void (*ctor)(void*, struct kmem_cache *, unsigned long))
496 void (*dtor)(void*, struct kmem_cache *, unsigned long))
497{ 496{
498 struct kmem_cache *c; 497 struct kmem_cache *c;
499 498
diff --git a/mm/slub.c b/mm/slub.c
index 322f3a5d72c7..9b2d6178d06c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2668,12 +2668,10 @@ static struct kmem_cache *find_mergeable(size_t size,
2668 2668
2669struct kmem_cache *kmem_cache_create(const char *name, size_t size, 2669struct kmem_cache *kmem_cache_create(const char *name, size_t size,
2670 size_t align, unsigned long flags, 2670 size_t align, unsigned long flags,
2671 void (*ctor)(void *, struct kmem_cache *, unsigned long), 2671 void (*ctor)(void *, struct kmem_cache *, unsigned long))
2672 void (*dtor)(void *, struct kmem_cache *, unsigned long))
2673{ 2672{
2674 struct kmem_cache *s; 2673 struct kmem_cache *s;
2675 2674
2676 BUG_ON(dtor);
2677 down_write(&slub_lock); 2675 down_write(&slub_lock);
2678 s = find_mergeable(size, align, flags, ctor); 2676 s = find_mergeable(size, align, flags, ctor);
2679 if (s) { 2677 if (s) {