All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Enable dmapool debugging for CONFIG_SLUB_DEBUG_ON too
@ 2008-03-11  1:34 Andi Kleen
  0 siblings, 0 replies; only message in thread
From: Andi Kleen @ 2008-03-11  1:34 UTC (permalink / raw)
  To: linux-kernel, akpm, clameter, willy

Enable dmapool debugging for CONFIG_SLUB_DEBUG_ON too

Previously it was only enabled for CONFIG_SLAB_DEBUG.

Not hooked into the slub runtime debug configuration, so you currently
only get it with CONFIG_SLUB_DEBUG_ON, not plain CONFIG_SLUB_DEBUG

Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux/mm/dmapool.c
===================================================================
--- linux.orig/mm/dmapool.c
+++ linux/mm/dmapool.c
@@ -37,6 +37,10 @@
 #include <linux/types.h>
 #include <linux/wait.h>
 
+#if defined(CONFIG_SLAB_DEBUG) || defined(CONFIG_SLUB_DEBUG_ON)
+#define DMAPOOL_DEBUG 1
+#endif
+
 struct dma_pool {		/* the pool */
 	struct list_head page_list;
 	spinlock_t lock;
@@ -216,7 +220,7 @@ static struct dma_page *pool_alloc_page(
 	page->vaddr = dma_alloc_coherent(pool->dev, pool->allocation,
 					 &page->dma, mem_flags);
 	if (page->vaddr) {
-#ifdef	CONFIG_DEBUG_SLAB
+#ifdef	DMAPOOL_DEBUG
 		memset(page->vaddr, POOL_POISON_FREED, pool->allocation);
 #endif
 		pool_initialise_page(pool, page);
@@ -239,7 +243,7 @@ static void pool_free_page(struct dma_po
 {
 	dma_addr_t dma = page->dma;
 
-#ifdef	CONFIG_DEBUG_SLAB
+#ifdef	DMAPOOL_DEBUG
 	memset(page->vaddr, POOL_POISON_FREED, pool->allocation);
 #endif
 	dma_free_coherent(pool->dev, pool->allocation, page->vaddr, dma);
@@ -336,7 +340,7 @@ void *dma_pool_alloc(struct dma_pool *po
 	page->offset = *(int *)(page->vaddr + offset);
 	retval = offset + page->vaddr;
 	*handle = offset + page->dma;
-#ifdef	CONFIG_DEBUG_SLAB
+#ifdef	DMAPOOL_DEBUG
 	memset(retval, POOL_POISON_ALLOCATED, pool->size);
 #endif
  done:
@@ -391,7 +395,7 @@ void dma_pool_free(struct dma_pool *pool
 	}
 
 	offset = vaddr - page->vaddr;
-#ifdef	CONFIG_DEBUG_SLAB
+#ifdef	DMAPOOL_DEBUG
 	if ((dma - page->dma) != offset) {
 		if (pool->dev)
 			dev_err(pool->dev,

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

only message in thread, other threads:[~2008-03-11  1:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-11  1:34 [PATCH] Enable dmapool debugging for CONFIG_SLUB_DEBUG_ON too Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.