lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1215673985.6165.72.camel@penberg-laptop>
Date:	Thu, 10 Jul 2008 10:13:04 +0300
From:	Pekka Enberg <penberg@...helsinki.fi>
To:	Alexey Dobriyan <adobriyan@...il.com>
Cc:	akpm@...ux-foundation.org, mpm@...enic.com, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, cl@...ux-foundation.org
Subject: Re: SL*B: drop kmem cache argument from constructor

Hi Alexey,

[Fixing up Andrew's email address.]

On Thu, 2008-07-10 at 05:11 +0400, Alexey Dobriyan wrote:
> 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.

Acked-by: Pekka Enberg <penberg@...helsinki.fi>

However...

> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -595,9 +595,9 @@ static int __init hugepage_setup_sz(char *str)
>  }
>  __setup("hugepagesz=", hugepage_setup_sz);
>  
> -static void zero_ctor(struct kmem_cache *cache, void *addr)
> +static void zero_ctor(void *addr)
>  {
> -	memset(addr, 0, kmem_cache_size(cache));
> +	memset(addr, 0, HUGEPTE_TABLE_SIZE);
>  }
>  
>  static int __init hugetlbpage_init(void)
> --- a/arch/powerpc/mm/init_64.c
> +++ b/arch/powerpc/mm/init_64.c
> @@ -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);
>  }

Can we please have these hunks merged first so that the final patch
which removes the 'cache' argument from the function signature has no
functional changes?

		Pekka

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ