The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Pekka J Enberg <penberg@cs.Helsinki.FI>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
	manfred@colorfullife.com, christoph@lameter.com
Subject: Re: [PATCH] slab: minor cleanup to kmem_cache_alloc_node
Date: Mon, 21 Nov 2005 16:58:21 +0100	[thread overview]
Message-ID: <4381EE9D.1000506@cosmosbay.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0511211627460.18869@sbz-30.cs.Helsinki.FI>

Pekka J Enberg a écrit :
> This patch gets rid of one if-else statement by moving current node allocation
> check at the beginning of kmem_cache_alloc_node().
> 

Are you sure this is valid ?
What about preemption ?
The "if (nodeid == numa_node_id())" check was done with IRQ off, and you want 
do do it with IRQ on.

> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
> 
>  slab.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index 7f80ec3..a05bbfe 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2881,7 +2881,7 @@ void *kmem_cache_alloc_node(kmem_cache_t
>  	unsigned long save_flags;
>  	void *ptr;
>  
> -	if (nodeid == -1)
> +	if (nodeid == -1 || nodeid == numa_node_id())

<Imagine preemption here, and thread migrated to another NUMA node.>

>  		return __cache_alloc(cachep, flags);
>  
>  	if (unlikely(!cachep->nodelists[nodeid])) {
> @@ -2892,10 +2892,7 @@ void *kmem_cache_alloc_node(kmem_cache_t
>  
>  	cache_alloc_debugcheck_before(cachep, flags);
>  	local_irq_save(save_flags);
> -	if (nodeid == numa_node_id())
> -		ptr = ____cache_alloc(cachep, flags);
> -	else
> -		ptr = __cache_alloc_node(cachep, flags, nodeid);
> +	ptr = __cache_alloc_node(cachep, flags, nodeid);
>  	local_irq_restore(save_flags);
>  	ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, __builtin_return_address(0));
>  


  reply	other threads:[~2005-11-21 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-21 14:30 [PATCH] slab: minor cleanup to kmem_cache_alloc_node Pekka J Enberg
2005-11-21 15:58 ` Eric Dumazet [this message]
2005-11-21 16:23   ` Pekka Enberg
2005-11-21 17:21 ` Christoph Lameter
2005-11-21 18:36   ` Pekka Enberg
2005-11-21 19:47     ` Christoph Lameter
2005-11-21 21:07       ` Pekka Enberg
2005-11-21 21:17         ` Christoph Lameter
2005-11-22  6:57           ` Pekka J Enberg

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=4381EE9D.1000506@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@osdl.org \
    --cc=christoph@lameter.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=penberg@cs.Helsinki.FI \
    /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