From: Christoph Lameter Date: Tue, 17 Jul 2007 11:03:27 +0000 (-0700) Subject: SLUB: Simplify dma index -> size calculation X-Git-Tag: v2.6.23-rc1~741 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=7b55f620e6908fec2d51751320c2a9459b5f375f;p=linux-2.6-omap-h63xx.git SLUB: Simplify dma index -> size calculation There is no need to caculate the dma slab size ourselves. We can simply lookup the size of the corresponding non dma slab. Signed-off-by: Christoph Lameter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slub.c b/mm/slub.c index 71988f9b9c5..2ae2dae12d9 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2289,15 +2289,7 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags) if (!x) panic("Unable to allocate memory for dma cache\n"); - if (index <= KMALLOC_SHIFT_HIGH) - realsize = 1 << index; - else { - if (index == 1) - realsize = 96; - else - realsize = 192; - } - + realsize = kmalloc_caches[index].objsize; text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", (unsigned int)realsize); s = create_kmalloc_cache(x, text, realsize, flags);