[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230103191551.3254778-6-kbusch@meta.com>
Date: Tue, 3 Jan 2023 11:15:44 -0800
From: Keith Busch <kbusch@...a.com>
To: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
Matthew Wilcox <willy@...radead.org>,
Christoph Hellwig <hch@....de>
CC: Tony Battersby <tonyb@...ernetics.com>,
Kernel Team <kernel-team@...a.com>,
Keith Busch <kbusch@...nel.org>
Subject: [PATCHv3 05/12] dmapool: speedup DMAPOOL_DEBUG with init_on_alloc
From: Tony Battersby <tonyb@...ernetics.com>
Avoid double-memset of the same allocated memory in dma_pool_alloc()
when both DMAPOOL_DEBUG is enabled and init_on_alloc=1.
Signed-off-by: Tony Battersby <tonyb@...ernetics.com>
Signed-off-by: Keith Busch <kbusch@...nel.org>
Reviewed-by: Christoph Hellwig <hch@....de>
---
mm/dmapool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/dmapool.c b/mm/dmapool.c
index ee993bb59fc27..eaed3ffb42aa8 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -356,7 +356,7 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
break;
}
}
- if (!(mem_flags & __GFP_ZERO))
+ if (!want_init_on_alloc(mem_flags))
memset(retval, POOL_POISON_ALLOCATED, pool->size);
#endif
spin_unlock_irqrestore(&pool->lock, flags);
--
2.30.2
Powered by blists - more mailing lists