Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1185055
| From | "Sean O. Stalley" <sean.stalley@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/4] mm: Add support for __GFP_ZERO flag to dma_pool_alloc() |
| Date | 2015-07-15 23:20 +0200 |
| Message-ID | <pMCfV-2Uk-29@gated-at.bofh.it> (permalink) |
| References | <pMCfU-2Uk-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Currently the __GFP_ZERO flag is ignored by dma_pool_alloc(). Make dma_pool_alloc() zero the memory if this flag is set. Signed-off-by: Sean O. Stalley <sean.stalley@intel.com> --- mm/dmapool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index fd5fe43..449a5d09 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -334,7 +334,7 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, /* pool_alloc_page() might sleep, so temporarily drop &pool->lock */ spin_unlock_irqrestore(&pool->lock, flags); - page = pool_alloc_page(pool, mem_flags); + page = pool_alloc_page(pool, mem_flags & (~__GFP_ZERO)); if (!page) return NULL; @@ -375,6 +375,10 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, memset(retval, POOL_POISON_ALLOCATED, pool->size); #endif spin_unlock_irqrestore(&pool->lock, flags); + + if (mem_flags & __GFP_ZERO) + memset(retval, 0, pool->size); + return retval; } EXPORT_SYMBOL(dma_pool_alloc); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] mm: add dma_pool_zalloc() & pci_pool_zalloc() "Sean O. Stalley" <sean.stalley@intel.com> - 2015-07-15 23:20 +0200
[PATCH 1/4] mm: Add support for __GFP_ZERO flag to dma_pool_alloc() "Sean O. Stalley" <sean.stalley@intel.com> - 2015-07-15 23:20 +0200
Re: [PATCH 1/4] mm: Add support for __GFP_ZERO flag to dma_pool_alloc() Andrew Morton <akpm@linux-foundation.org> - 2015-07-15 23:30 +0200
csiph-web