]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/dmapool.c: avoid duplicate memset within dma_pool_alloc
authorLiu Song <liusong@linux.alibaba.com>
Mon, 18 Jul 2022 06:28:10 +0000 (14:28 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 17 Aug 2022 20:58:35 +0000 (13:58 -0700)
commit13b3b75248fe48b141ddfe849f8fe24d5da2de25
tree3133c96ab70f71e7d16901e46520a02753d961bf
parent0a200f9f794e0d9e34fd675ecca12a5d0b1ed257
mm/dmapool.c: avoid duplicate memset within dma_pool_alloc

In "dma_alloc_from_dev_coherent" and "dma_direct_alloc",
the allocated memory is explicitly set to 0.

A helper function "use_dev_coherent_memory" is introduced here to
determine whether the memory is allocated by "dma_alloc_from_dev_coherent".

And use "get_dma_ops" to determine whether the memory is allocated by
"dma_direct_alloc".

After this modification, memory allocated using "dma_pool_zalloc" can avoid
duplicate memset.

Link: https://lkml.kernel.org/r/1658125690-76930-1-git-send-email-liusong@linux.alibaba.com
Signed-off-by: Liu Song <liusong@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/dma-map-ops.h
mm/dmapool.c