Re: [PATCH] mm/dmapool: remove redundant DMAPOOL_DEBUG macro

From: Vlastimil Babka (SUSE)

Date: Fri May 22 2026 - 07:20:02 EST


On 5/22/26 12:53, lirongqing wrote:
> From: Li RongQing <lirongqing@xxxxxxxxx>
>
> The DMAPOOL_DEBUG macro is only defined when CONFIG_SLUB_DEBUG_ON is
> enabled, and it is used exclusively to guard the pool_check_block()
> function. Wrapping CONFIG_SLUB_DEBUG_ON in another local macro adds
> unnecessary indirection.
>
> Simplify the code by removing DMAPOOL_DEBUG entirely and using the
> standard CONFIG_SLUB_DEBUG_ON config option directly.
>
> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>

I think a more useful change would be to remove the usage of
CONFIG_SLUB_DEBUG_ON completely and rather (re)use a boot option that uses a
static key. CONFIG_SLUB_DEBUG_ON is only useful for bots running
randconfigs, otherwise normally for debugging a specific problem one doesn't
want to rebuild a kernel with CONFIG_SLUB_DEBUG_ON, but just reboot with a
boot option slab_debug[=...] (for slab itself) or debug_pagealloc=on etc.

(same thing should be done for the usage in mm/mempool.c btw)

> ---
> mm/dmapool.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/mm/dmapool.c b/mm/dmapool.c
> index 5d8af6e..af43f1a 100644
> --- a/mm/dmapool.c
> +++ b/mm/dmapool.c
> @@ -36,10 +36,6 @@
> #include <linux/types.h>
> #include <linux/wait.h>
>
> -#ifdef CONFIG_SLUB_DEBUG_ON
> -#define DMAPOOL_DEBUG 1
> -#endif
> -
> struct dma_block {
> struct dma_block *next_block;
> dma_addr_t dma;
> @@ -92,7 +88,7 @@ static ssize_t pools_show(struct device *dev, struct device_attribute *attr, cha
>
> static DEVICE_ATTR_RO(pools);
>
> -#ifdef DMAPOOL_DEBUG
> +#ifdef CONFIG_SLUB_DEBUG_ON
> static void pool_check_block(struct dma_pool *pool, struct dma_block *block,
> gfp_t mem_flags)
> {