Commit 51cc5068 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

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: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Acked-by: default avatarChristoph 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d9195881
Showing with 32 additions and 43 deletions
+32 -43
......@@ -1304,7 +1304,7 @@ struct sysdev_class dma_sysclass = {
/* kmem cache implementation */
static void s3c2410_dma_cache_ctor(struct kmem_cache *c, void *p)
static void s3c2410_dma_cache_ctor(void *p)
{
memset(p, 0, sizeof(struct s3c2410_dma_buf));
}
......
......@@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
}
/* constructor for flash_block_cache */
void rtas_block_ctor(struct kmem_cache *cache, void *ptr)
void rtas_block_ctor(void *ptr)
{
memset(ptr, 0, RTAS_BLK_SIZE);
}
......
......@@ -113,7 +113,7 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
unsigned long address, unsigned int psize)
{
pte_t *new = kmem_cache_alloc(huge_pgtable_cache(psize),
pte_t *new = kmem_cache_zalloc(huge_pgtable_cache(psize),
GFP_KERNEL|__GFP_REPEAT);
if (! new)
......@@ -730,11 +730,6 @@ static int __init hugepage_setup_sz(char *str)
}
__setup("hugepagesz=", hugepage_setup_sz);
static void zero_ctor(struct kmem_cache *cache, void *addr)
{
memset(addr, 0, kmem_cache_size(cache));
}
static int __init hugetlbpage_init(void)
{
unsigned int psize;
......@@ -756,7 +751,7 @@ static int __init hugetlbpage_init(void)
HUGEPTE_TABLE_SIZE(psize),
HUGEPTE_TABLE_SIZE(psize),
0,
zero_ctor);
NULL);
if (!huge_pgtable_cache(psize))
panic("hugetlbpage_init(): could not create %s"\
"\n", HUGEPTE_CACHE_NAME(psize));
......
......@@ -136,9 +136,14 @@ static int __init setup_kcore(void)
module_init(setup_kcore);
#endif
static void zero_ctor(struct kmem_cache *cache, void *addr)
static void pgd_ctor(void *addr)
{
memset(addr, 0, kmem_cache_size(cache));
memset(addr, 0, PGD_TABLE_SIZE);
}
static void pmd_ctor(void *addr)
{
memset(addr, 0, PMD_TABLE_SIZE);
}
static const unsigned int pgtable_cache_size[2] = {
......@@ -163,19 +168,8 @@ struct kmem_cache *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)];
void pgtable_cache_init(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) {
int size = pgtable_cache_size[i];
const char *name = pgtable_cache_name[i];
pr_debug("Allocating page table cache %s (#%d) "
"for size: %08x...\n", name, i, size);
pgtable_cache[i] = kmem_cache_create(name,
size, size,
SLAB_PANIC,
zero_ctor);
}
pgtable_cache[0] = kmem_cache_create(pgtable_cache_name[0], PGD_TABLE_SIZE, PGD_TABLE_SIZE, SLAB_PANIC, pgd_ctor);
pgtable_cache[1] = kmem_cache_create(pgtable_cache_name[1], PMD_TABLE_SIZE, PMD_TABLE_SIZE, SLAB_PANIC, pmd_ctor);
}
#ifdef CONFIG_SPARSEMEM_VMEMMAP
......
......@@ -78,7 +78,7 @@ spufs_destroy_inode(struct inode *inode)
}
static void
spufs_init_once(struct kmem_cache *cachep, void *p)
spufs_init_once(void *p)
{
struct spufs_inode_info *ei = p;
......
......@@ -293,7 +293,7 @@ void pmb_unmap(unsigned long addr)
} while (pmbe);
}
static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb)
static void pmb_cache_ctor(void *pmb)
{
struct pmb_entry *pmbe = pmb;
......
......@@ -309,7 +309,7 @@ void show_mem(void)
struct kmem_cache *pgtable_cache __read_mostly;
static void pgd_ctor(struct kmem_cache *cache, void* addr)
static void pgd_ctor(void* addr)
{
pte_t* ptep = (pte_t*)addr;
int i;
......
......@@ -87,7 +87,7 @@ struct mon_reader_text {
static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */
static void mon_text_ctor(struct kmem_cache *, void *);
static void mon_text_ctor(void *);
struct mon_text_ptr {
int cnt, limit;
......@@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus)
/*
* Slab interface: constructor.
*/
static void mon_text_ctor(struct kmem_cache *slab, void *mem)
static void mon_text_ctor(void *mem)
{
/*
* Nothing to initialize. No, really!
......
......@@ -249,7 +249,7 @@ static void adfs_destroy_inode(struct inode *inode)
kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
}
static void init_once(struct kmem_cache *cachep, void *foo)
static void init_once(void *foo)
{
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
......
......@@ -90,7 +90,7 @@ static void affs_destroy_inode(struct inode *inode)
kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
}
static void init_once(struct kmem_cache *cachep, void *foo)
static void init_once(void *foo)
{
struct affs_inode_info *ei = (struct affs_inode_info *) foo;
......
......@@ -27,7 +27,7 @@
#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
static void afs_i_init_once(struct kmem_cache *cachep, void *foo);
static void afs_i_init_once(void *foo);
static int afs_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data, struct vfsmount *mnt);
......@@ -449,7 +449,7 @@ static void afs_put_super(struct super_block *sb)
/*
* initialise an inode cache slab element prior to any use
*/
static void afs_i_init_once(struct kmem_cache *cachep, void *_vnode)
static void afs_i_init_once(void *_vnode)
{
struct afs_vnode *vnode = _vnode;
......
......@@ -289,7 +289,7 @@ befs_destroy_inode(struct inode *inode)
kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
}
static void init_once(struct kmem_cache *cachep, void *foo)
static void init_once(void *foo)
{
struct befs_inode_info *bi = (struct befs_inode_info *) foo;
......
......@@ -264,7 +264,7 @@ static void bfs_destroy_inode(struct inode *inode)
kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
}
static void init_once(struct kmem_cache *cachep, void *foo)
static void init_once(void *foo)
{
struct bfs_inode_info *bi = foo;
......
......@@ -271,7 +271,7 @@ static void bdev_destroy_inode(struct inode *inode)
kmem_cache_free(bdev_cachep, bdi);
}
static void init_once(struct kmem_cache * cachep, void *foo)
static void init_once(void *foo)
{
struct bdev_inode *ei = (struct bdev_inode *) foo;
struct block_device *bdev = &ei->bdev;
......
......@@ -3272,7 +3272,7 @@ int bh_submit_read(struct buffer_head *bh)
EXPORT_SYMBOL(bh_submit_read);
static void
init_buffer_head(struct kmem_cache *cachep, void *data)
init_buffer_head(void *data)
{
struct buffer_head *bh = data;
......
......@@ -766,7 +766,7 @@ const struct file_operations cifs_dir_ops = {
};
static void
cifs_init_once(struct kmem_cache *cachep, void *inode)
cifs_init_once(void *inode)
{
struct cifsInodeInfo *cifsi = inode;
......
......@@ -58,7 +58,7 @@ static void coda_destroy_inode(struct inode *inode)
kmem_cache_free(coda_inode_cachep, ITOC(inode));
}
static void init_once(struct kmem_cache * cachep, void *foo)
static void init_once(void *foo)
{
struct coda_inode_info *ei = (struct coda_inode_info *) foo;
......
......@@ -578,7 +578,7 @@ static struct file_system_type ecryptfs_fs_type = {
* Initializes the ecryptfs_inode_info_cache when it is created
*/
static void
inode_info_init_once(struct kmem_cache *cachep, void *vptr)
inode_info_init_once(void *vptr)
{
struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr;
......@@ -589,7 +589,7 @@ static struct ecryptfs_cache_info {
struct kmem_cache **cache;
const char *name;
size_t size;
void (*ctor)(struct kmem_cache *cache, void *obj);
void (*ctor)(void *obj);
} ecryptfs_cache_infos[] = {
{
.cache = &ecryptfs_auth_tok_list_item_cache,
......
......@@ -70,7 +70,7 @@ static void efs_destroy_inode(struct inode *inode)
kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
}
static void init_once(struct kmem_cache *cachep, void *foo)
static void init_once(void *foo)
{
struct efs_inode_info *ei = (struct efs_inode_info *) foo;
......
......@@ -159,7 +159,7 @@ static void ext2_destroy_inode(struct inode *inode)
kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
}
static void init_once(struct kmem_cache * cachep, void *foo)
static void init_once(void *foo)
{
struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment