Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1304,7 +1304,7 @@ struct sysdev_class dma_sysclass = {


/* kmem cache implementation */
/* 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));
	memset(p, 0, sizeof(struct s3c2410_dma_buf));
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
}
}


/* constructor for flash_block_cache */
/* 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);
	memset(ptr, 0, RTAS_BLK_SIZE);
}
}
+2 −7
Original line number Original line Diff line number Diff line
@@ -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,
static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
			   unsigned long address, unsigned int psize)
			   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);
				      GFP_KERNEL|__GFP_REPEAT);


	if (! new)
	if (! new)
@@ -730,11 +730,6 @@ static int __init hugepage_setup_sz(char *str)
}
}
__setup("hugepagesz=", hugepage_setup_sz);
__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)
static int __init hugetlbpage_init(void)
{
{
	unsigned int psize;
	unsigned int psize;
@@ -756,7 +751,7 @@ static int __init hugetlbpage_init(void)
						HUGEPTE_TABLE_SIZE(psize),
						HUGEPTE_TABLE_SIZE(psize),
						HUGEPTE_TABLE_SIZE(psize),
						HUGEPTE_TABLE_SIZE(psize),
						0,
						0,
						zero_ctor);
						NULL);
			if (!huge_pgtable_cache(psize))
			if (!huge_pgtable_cache(psize))
				panic("hugetlbpage_init(): could not create %s"\
				panic("hugetlbpage_init(): could not create %s"\
				      "\n", HUGEPTE_CACHE_NAME(psize));
				      "\n", HUGEPTE_CACHE_NAME(psize));
+9 −15
Original line number Original line Diff line number Diff line
@@ -136,9 +136,14 @@ static int __init setup_kcore(void)
module_init(setup_kcore);
module_init(setup_kcore);
#endif
#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] = {
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)
void pgtable_cache_init(void)
{
{
	int i;
	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);
	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);
	}
}
}


#ifdef CONFIG_SPARSEMEM_VMEMMAP
#ifdef CONFIG_SPARSEMEM_VMEMMAP
+1 −1
Original line number Original line Diff line number Diff line
@@ -78,7 +78,7 @@ spufs_destroy_inode(struct inode *inode)
}
}


static void
static void
spufs_init_once(struct kmem_cache *cachep, void *p)
spufs_init_once(void *p)
{
{
	struct spufs_inode_info *ei = p;
	struct spufs_inode_info *ei = p;


Loading