SLUB: Simplify dma index -> size calculation
authorChristoph Lameter <[email protected]>
Tue, 17 Jul 2007 11:03:27 +0000 (04:03 -0700)
committerLinus Torvalds <[email protected]>
Tue, 17 Jul 2007 17:23:01 +0000 (10:23 -0700)
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/slub.c

index 71988f9b9c55cbeb582c5fa3a2e2feb8e44d60d6..2ae2dae12d9abf6c2f4b14cce9af39d33b742e7b 100644 (file)
--- 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);