2012/10/24 Christoph Lameter <cl@xxxxxxxxx>: > 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. > __find_general_cachep() is called by __do_kmalloc(). And __do_kmalloc() is called by __kmalloc(). __kmalloc() is called by kmalloc() when buildin_constant_p is failed. Therefore __find_general_cachep() is called with arbitrary size value and kmalloc_index() cannot be folded. But, I think it doesn't matter, because CK2[15/15] also solve this problem. Thanks. -- 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>