Re: [patch 3/4] slub: use is_kmalloc_cache in dma_kmalloc_cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]