Skip to content

Commit

Permalink
mm: Remove slab destructors from kmem_cache_create().
Browse files Browse the repository at this point in the history
Slab destructors were no longer supported after Christoph's
c59def9 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 <[email protected]>
  • Loading branch information
pmundt committed Jul 20, 2007
1 parent 64fb98f commit 20c2df8
Show file tree
Hide file tree
Showing 165 changed files with 247 additions and 268 deletions.
2 changes: 1 addition & 1 deletion arch/arm/plat-s3c24xx/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ int __init s3c24xx_dma_init(unsigned int channels, unsigned int irq,
dma_kmem = kmem_cache_create("dma_desc",
sizeof(struct s3c2410_dma_buf), 0,
SLAB_HWCACHE_ALIGN,
s3c2410_dma_cache_ctor, NULL);
s3c2410_dma_cache_ctor);

if (dma_kmem == NULL) {
printk(KERN_ERR "dma failed to make kmem cache\n");
Expand Down
4 changes: 2 additions & 2 deletions arch/arm26/mm/memc.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ void __init pgtable_cache_init(void)
{
pte_cache = kmem_cache_create("pte-cache",
sizeof(pte_t) * PTRS_PER_PTE,
0, SLAB_PANIC, pte_cache_ctor, NULL);
0, SLAB_PANIC, pte_cache_ctor);

pgd_cache = kmem_cache_create("pgd-cache", MEMC_TABLE_SIZE +
sizeof(pgd_t) * PTRS_PER_PGD,
0, SLAB_PANIC, pgd_cache_ctor, NULL);
0, SLAB_PANIC, pgd_cache_ctor);
}
3 changes: 1 addition & 2 deletions arch/i386/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,7 @@ void __init pgtable_cache_init(void)
PTRS_PER_PMD*sizeof(pmd_t),
PTRS_PER_PMD*sizeof(pmd_t),
SLAB_PANIC,
pmd_ctor,
NULL);
pmd_ctor);
if (!SHARED_KERNEL_PMD) {
/* If we're in PAE mode and have a non-shared
kernel pmd, then the pgd size must be a
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/ia32/ia32_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ ia32_init (void)

partial_page_cachep = kmem_cache_create("partial_page_cache",
sizeof(struct partial_page),
0, SLAB_PANIC, NULL, NULL);
0, SLAB_PANIC, NULL);
}
#endif
return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/rtas_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ int __init rtas_flash_init(void)

flash_block_cache = kmem_cache_create("rtas_flash_cache",
RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
rtas_block_ctor, NULL);
rtas_block_ctor);
if (!flash_block_cache) {
printk(KERN_ERR "%s: failed to create block cache\n",
__FUNCTION__);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ static int __init hugetlbpage_init(void)
HUGEPTE_TABLE_SIZE,
HUGEPTE_TABLE_SIZE,
0,
zero_ctor, NULL);
zero_ctor);
if (! huge_pgtable_cache)
panic("hugetlbpage_init(): could not create hugepte cache\n");

Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ void pgtable_cache_init(void)
pgtable_cache[i] = kmem_cache_create(name,
size, size,
SLAB_PANIC,
zero_ctor,
NULL);
zero_ctor);
}
}
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/spufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ static int __init spufs_init(void)
ret = -ENOMEM;
spufs_inode_cache = kmem_cache_create("spufs_inode_cache",
sizeof(struct spufs_inode_info), 0,
SLAB_HWCACHE_ALIGN, spufs_init_once, NULL);
SLAB_HWCACHE_ALIGN, spufs_init_once);

if (!spufs_inode_cache)
goto out;
Expand Down
3 changes: 1 addition & 2 deletions arch/sh/kernel/cpu/sh4/sq.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ static int __init sq_api_init(void)
printk(KERN_NOTICE "sq: Registering store queue API.\n");

sq_cache = kmem_cache_create("store_queue_cache",
sizeof(struct sq_mapping), 0, 0,
NULL, NULL);
sizeof(struct sq_mapping), 0, 0, NULL);
if (unlikely(!sq_cache))
return ret;

Expand Down
2 changes: 1 addition & 1 deletion arch/sh/mm/pmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static int __init pmb_init(void)
BUG_ON(unlikely(nr_entries >= NR_PMB_ENTRIES));

pmb_cache = kmem_cache_create("pmb", sizeof(struct pmb_entry), 0,
SLAB_PANIC, pmb_cache_ctor, NULL);
SLAB_PANIC, pmb_cache_ctor);

jump_to_P2();

Expand Down
3 changes: 1 addition & 2 deletions arch/sparc64/mm/tsb.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@ void __init pgtable_cache_init(void)

tsb_caches[i] = kmem_cache_create(name,
size, size,
0,
NULL, NULL);
0, NULL);
if (!tsb_caches[i]) {
prom_printf("Could not create %s cache\n", name);
prom_halt();
Expand Down
2 changes: 1 addition & 1 deletion block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ static int __init bsg_init(void)
dev_t devid;

bsg_cmd_cachep = kmem_cache_create("bsg_cmd",
sizeof(struct bsg_command), 0, 0, NULL, NULL);
sizeof(struct bsg_command), 0, 0, NULL);
if (!bsg_cmd_cachep) {
printk(KERN_ERR "bsg: failed creating slab cache\n");
return -ENOMEM;
Expand Down
6 changes: 3 additions & 3 deletions block/ll_rw_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3698,13 +3698,13 @@ int __init blk_dev_init(void)
panic("Failed to create kblockd\n");

request_cachep = kmem_cache_create("blkdev_requests",
sizeof(struct request), 0, SLAB_PANIC, NULL, NULL);
sizeof(struct request), 0, SLAB_PANIC, NULL);

requestq_cachep = kmem_cache_create("blkdev_queue",
sizeof(request_queue_t), 0, SLAB_PANIC, NULL, NULL);
sizeof(request_queue_t), 0, SLAB_PANIC, NULL);

iocontext_cachep = kmem_cache_create("blkdev_ioc",
sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL);
sizeof(struct io_context), 0, SLAB_PANIC, NULL);

for_each_possible_cpu(i)
INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i));
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
acpi_status
acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
{
*cache = kmem_cache_create(name, size, 0, 0, NULL, NULL);
*cache = kmem_cache_create(name, size, 0, 0, NULL);
if (*cache == NULL)
return AE_ERROR;
else
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/aoe/aoeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ aoeblk_exit(void)
int __init
aoeblk_init(void)
{
buf_pool_cache = kmem_cache_create("aoe_bufs",
buf_pool_cache = kmem_cache_create("aoe_bufs",
sizeof(struct buf),
0, 0, NULL, NULL);
0, 0, NULL);
if (buf_pool_cache == NULL)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/ieee1394/eth1394.c
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ static int __init ether1394_init_module(void)

packet_task_cache = kmem_cache_create("packet_task",
sizeof(struct packet_task),
0, 0, NULL, NULL);
0, 0, NULL);
if (!packet_task_cache)
return -ENOMEM;

Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/core/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -2998,7 +2998,6 @@ static int __init ib_mad_init_module(void)
sizeof(struct ib_mad_private),
0,
SLAB_HWCACHE_ALIGN,
NULL,
NULL);
if (!ib_mad_cache) {
printk(KERN_ERR PFX "Couldn't create ib_mad cache\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/amso1100/c2_vq.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int vq_init(struct c2_dev *c2dev)
(char) ('0' + c2dev->devnum));
c2dev->host_msg_cache =
kmem_cache_create(c2dev->vq_cache_name, c2dev->rep_vq.msg_size, 0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
SLAB_HWCACHE_ALIGN, NULL);
if (c2dev->host_msg_cache == NULL) {
return -ENOMEM;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ehca/ehca_av.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ int ehca_init_av_cache(void)
av_cache = kmem_cache_create("ehca_cache_av",
sizeof(struct ehca_av), 0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!av_cache)
return -ENOMEM;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ehca/ehca_cq.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ int ehca_init_cq_cache(void)
cq_cache = kmem_cache_create("ehca_cache_cq",
sizeof(struct ehca_cq), 0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!cq_cache)
return -ENOMEM;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ehca/ehca_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static int ehca_create_slab_caches(void)
ctblk_cache = kmem_cache_create("ehca_cache_ctblk",
EHCA_PAGESIZE, H_CB_ALIGNMENT,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!ctblk_cache) {
ehca_gen_err("Cannot create ctblk SLAB cache.");
ehca_cleanup_mrmw_cache();
Expand Down
4 changes: 2 additions & 2 deletions drivers/infiniband/hw/ehca/ehca_mrmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,13 +1950,13 @@ int ehca_init_mrmw_cache(void)
mr_cache = kmem_cache_create("ehca_cache_mr",
sizeof(struct ehca_mr), 0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!mr_cache)
return -ENOMEM;
mw_cache = kmem_cache_create("ehca_cache_mw",
sizeof(struct ehca_mw), 0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!mw_cache) {
kmem_cache_destroy(mr_cache);
mr_cache = NULL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ehca/ehca_pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int ehca_init_pd_cache(void)
pd_cache = kmem_cache_create("ehca_cache_pd",
sizeof(struct ehca_pd), 0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!pd_cache)
return -ENOMEM;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ehca/ehca_qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ int ehca_init_qp_cache(void)
qp_cache = kmem_cache_create("ehca_cache_qp",
sizeof(struct ehca_qp), 0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!qp_cache)
return -ENOMEM;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/iser/iscsi_iser.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ static int __init iser_init(void)
ig.desc_cache = kmem_cache_create("iser_descriptors",
sizeof (struct iser_desc),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (ig.desc_cache == NULL)
return -ENOMEM;

Expand Down
8 changes: 4 additions & 4 deletions drivers/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,24 +1332,24 @@ int kvm_mmu_module_init(void)
{
pte_chain_cache = kmem_cache_create("kvm_pte_chain",
sizeof(struct kvm_pte_chain),
0, 0, NULL, NULL);
0, 0, NULL);
if (!pte_chain_cache)
goto nomem;
rmap_desc_cache = kmem_cache_create("kvm_rmap_desc",
sizeof(struct kvm_rmap_desc),
0, 0, NULL, NULL);
0, 0, NULL);
if (!rmap_desc_cache)
goto nomem;

mmu_page_cache = kmem_cache_create("kvm_mmu_page",
PAGE_SIZE,
PAGE_SIZE, 0, NULL, NULL);
PAGE_SIZE, 0, NULL);
if (!mmu_page_cache)
goto nomem;

mmu_page_header_cache = kmem_cache_create("kvm_mmu_page_header",
sizeof(struct kvm_mmu_page),
0, 0, NULL, NULL);
0, 0, NULL);
if (!mmu_page_header_cache)
goto nomem;

Expand Down
4 changes: 2 additions & 2 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ static int grow_stripes(raid5_conf_t *conf, int num)
conf->active_name = 0;
sc = kmem_cache_create(conf->cache_name[conf->active_name],
sizeof(struct stripe_head)+(devs-1)*sizeof(struct r5dev),
0, 0, NULL, NULL);
0, 0, NULL);
if (!sc)
return 1;
conf->slab_cache = sc;
Expand Down Expand Up @@ -1003,7 +1003,7 @@ static int resize_stripes(raid5_conf_t *conf, int newsize)
/* Step 1 */
sc = kmem_cache_create(conf->cache_name[1-conf->active_name],
sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev),
0, 0, NULL, NULL);
0, 0, NULL);
if (!sc)
return -ENOMEM;

Expand Down
3 changes: 1 addition & 2 deletions drivers/message/i2o/i2o_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,7 @@ static int __init i2o_block_init(void)
/* Allocate request mempool and slab */
size = sizeof(struct i2o_block_request);
i2o_blk_req_pool.slab = kmem_cache_create("i2o_block_req", size, 0,
SLAB_HWCACHE_ALIGN, NULL,
NULL);
SLAB_HWCACHE_ALIGN, NULL);
if (!i2o_blk_req_pool.slab) {
osm_err("can't init request slab\n");
rc = -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/ubi/eba.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si)
if (ubi_devices_cnt == 0) {
ltree_slab = kmem_cache_create("ubi_ltree_slab",
sizeof(struct ltree_entry), 0,
0, &ltree_entry_ctor, NULL);
0, &ltree_entry_ctor);
if (!ltree_slab)
return -ENOMEM;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/ubi/wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si)
if (ubi_devices_cnt == 0) {
wl_entries_slab = kmem_cache_create("ubi_wl_entry_slab",
sizeof(struct ubi_wl_entry),
0, 0, NULL, NULL);
0, 0, NULL);
if (!wl_entries_slab)
return -ENOMEM;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/block/dasd_devmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ dasd_parse_keyword( char *parsestring ) {
dasd_page_cache =
kmem_cache_create("dasd_page_cache", PAGE_SIZE,
PAGE_SIZE, SLAB_CACHE_DMA,
NULL, NULL );
NULL);
if (!dasd_page_cache)
MESSAGE(KERN_WARNING, "%s", "Failed to create slab, "
"fixed buffer mode disabled.");
Expand Down
6 changes: 3 additions & 3 deletions drivers/s390/scsi/zfcp_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,21 @@ zfcp_module_init(void)
size = sizeof(struct zfcp_fsf_req_qtcb);
align = calc_alignment(size);
zfcp_data.fsf_req_qtcb_cache =
kmem_cache_create("zfcp_fsf", size, align, 0, NULL, NULL);
kmem_cache_create("zfcp_fsf", size, align, 0, NULL);
if (!zfcp_data.fsf_req_qtcb_cache)
goto out;

size = sizeof(struct fsf_status_read_buffer);
align = calc_alignment(size);
zfcp_data.sr_buffer_cache =
kmem_cache_create("zfcp_sr", size, align, 0, NULL, NULL);
kmem_cache_create("zfcp_sr", size, align, 0, NULL);
if (!zfcp_data.sr_buffer_cache)
goto out_sr_cache;

size = sizeof(struct zfcp_gid_pn_data);
align = calc_alignment(size);
zfcp_data.gid_pn_cache =
kmem_cache_create("zfcp_gid", size, align, 0, NULL, NULL);
kmem_cache_create("zfcp_gid", size, align, 0, NULL);
if (!zfcp_data.gid_pn_cache)
goto out_gid_cache;

Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aic94xx/aic94xx_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ static int asd_create_global_caches(void)
sizeof(struct asd_dma_tok),
0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!asd_dma_token_cache) {
asd_printk("couldn't create dma token cache\n");
return -ENOMEM;
Expand All @@ -474,7 +474,7 @@ static int asd_create_global_caches(void)
sizeof(struct asd_ascb),
0,
SLAB_HWCACHE_ALIGN,
NULL, NULL);
NULL);
if (!asd_ascb_cache) {
asd_printk("couldn't create ascb cache\n");
goto Err;
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libsas/sas_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ EXPORT_SYMBOL_GPL(sas_domain_release_transport);
static int __init sas_class_init(void)
{
sas_task_cache = kmem_cache_create("sas_task", sizeof(struct sas_task),
0, SLAB_HWCACHE_ALIGN, NULL, NULL);
0, SLAB_HWCACHE_ALIGN, NULL);
if (!sas_task_cache)
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/qla2xxx/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ qla2x00_module_init(void)

/* Allocate cache for SRBs. */
srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
SLAB_HWCACHE_ALIGN, NULL);
if (srb_cachep == NULL) {
printk(KERN_ERR
"qla2xxx: Unable to allocate SRB cache...Failing load!\n");
Expand Down
Loading

0 comments on commit 20c2df8

Please sign in to comment.