linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>, linux-mm@kvack.org
Subject: Re: [patch 3/4] slub: use is_kmalloc_cache in dma_kmalloc_cache
Date: Wed, 9 Jun 2010 12:47:28 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1006091246160.26827@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1006091120460.21686@router.home>

On Wed, 9 Jun 2010, Christoph Lameter wrote:

> > diff --git a/mm/slub.c b/mm/slub.c
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -2649,13 +2649,12 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
> >  	text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d",
> >  			 (unsigned int)realsize);
> >
> > -	s = NULL;
> >  	for (i = 0; i < KMALLOC_CACHES; i++)
> >  		if (!kmalloc_caches[i].size)
> >  			break;
> >
> > -	BUG_ON(i >= KMALLOC_CACHES);
> >  	s = kmalloc_caches + i;
> > +	BUG_ON(!is_kmalloc_cache(s));
> 
> The point here is to check if the index I is still within the bonds of
> kmalloc_cache. Use of is_kmalloc_cache() will confuse the reader.
> 

Why does that confuse the reader?  It ensures that s is actually still a 
kmalloc_cache, meaning that i is within the bounds of the kmalloc_caches 
array.  Seems pretty straightforward to me.

--
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:[~2010-06-09 19:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09  6:49 [patch 1/4] slub: replace SLAB_NODE_UNSPECIFIED with NUMA_NO_NODE David Rientjes
2010-06-09  6:49 ` [patch 2/4] slub: rename debug_on to cache_debug_on David Rientjes
2010-06-09 16:20   ` Christoph Lameter
2010-06-09  6:49 ` [patch 3/4] slub: use is_kmalloc_cache in dma_kmalloc_cache David Rientjes
2010-06-09 16:24   ` Christoph Lameter
2010-06-09 19:47     ` David Rientjes [this message]
2010-06-09  6:49 ` [patch 4/4] slub: remove gfp_flags argument from create_kmalloc_cache David Rientjes
2010-06-09 16:24   ` Christoph Lameter
2010-06-09 16:44     ` Pekka Enberg
2010-06-15 17:33       ` Christoph Lameter
2010-06-15 21:39         ` David Rientjes
2010-06-16 15:26           ` Christoph Lameter
2010-06-09 16:18 ` [patch 1/4] slub: replace SLAB_NODE_UNSPECIFIED with NUMA_NO_NODE Christoph Lameter
2010-06-09 16:44   ` Pekka 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=alpine.DEB.2.00.1006091246160.26827@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=cl@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --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