linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* SLUB: Simplify dma index -> size calculation
@ 2007-06-27 12:51 Christoph Lameter
  0 siblings, 0 replies; only message in thread
From: Christoph Lameter @ 2007-06-27 12:51 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm

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>

---
 mm/slub.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Index: linux-2.6.22-rc4-mm2/mm/slub.c
===================================================================
--- linux-2.6.22-rc4-mm2.orig/mm/slub.c	2007-06-23 12:05:36.000000000 -0700
+++ linux-2.6.22-rc4-mm2/mm/slub.c	2007-06-23 12:05:46.000000000 -0700
@@ -2481,15 +2481,7 @@ static noinline struct kmem_cache *dma_k
 	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);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-27 12:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-27 12:51 SLUB: Simplify dma index -> size calculation Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox