Skip to content

Commit

Permalink
SLUB: Simplify dma index -> size calculation
Browse files Browse the repository at this point in the history
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 <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Jul 17, 2007
1 parent f1b2633 commit 7b55f62
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7b55f62

Please sign in to comment.