Re: CK2 [08/15] slab: Use common kmalloc_index/kmalloc_size functions

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

 



On Sun, 21 Oct 2012, JoonSoo Kim wrote:

> 2012/10/19 Christoph Lameter <cl@xxxxxxxxx>:
>
> > @@ -693,20 +657,19 @@ static inline struct array_cache *cpu_ca
> >  static inline struct kmem_cache *__find_general_cachep(size_t size,
> >                                                         gfp_t gfpflags)
> >  {
> > -       struct cache_sizes *csizep = malloc_sizes;
> > +       int i;
> >
> >  #if DEBUG
> >         /* This happens if someone tries to call
> >          * kmem_cache_create(), or __kmalloc(), before
> >          * the generic caches are initialized.
> >          */
> > -       BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
> > +       BUG_ON(kmalloc_caches[INDEX_AC] == NULL);
> >  #endif
> >         if (!size)
> >                 return ZERO_SIZE_PTR;
> >
> > -       while (size > csizep->cs_size)
> > -               csizep++;
> > +       i = kmalloc_index(size);
>
> Above kmalloc_index(size) is called with arbitrary size, therefore it
> cannot be folded.

The size is passed into an inline function that is folded and therefore
the kmalloc_index function can also be folded if the size passed into
__find_general_cachep was constant.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  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]