linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, mpm@selenic.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, cl@linux-foundation.org
Subject: Re: SL*B: drop kmem cache argument from constructor
Date: Thu, 10 Jul 2008 10:13:04 +0300	[thread overview]
Message-ID: <1215673985.6165.72.camel@penberg-laptop> (raw)
In-Reply-To: <20080710011132.GA8327@martell.zuzino.mipt.ru>

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@cs.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-07-10  7:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10  1:11 Alexey Dobriyan
2008-07-10  7:13 ` Pekka Enberg [this message]
2008-07-10 13:24 ` Christoph Lameter
2008-07-10 16:44 ` Jon Tollefson
2008-07-11 19:22   ` Andrew Morton
2008-07-11 19:38     ` Matt Mackall
2008-07-11 21:40     ` Jon Tollefson
2008-07-14  4:48       ` Nick Piggin
2008-07-14  4:44     ` Nick Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1215673985.6165.72.camel@penberg-laptop \
    --to=penberg@cs.helsinki.fi \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox