public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] arm64/dma-mapping: remove an unnecessary conversion
@ 2016-03-15  2:12 Zhen Lei
  2016-03-15 15:37 ` Catalin Marinas
  0 siblings, 1 reply; 6+ messages in thread
From: Zhen Lei @ 2016-03-15  2:12 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, linux-kernel
  Cc: Zefan Li, Xinwei Hu, Tianhong Ding, Hanjun Guo, Zhen Lei

1. In swiotlb_alloc_coherent, the branch of __get_free_pages. Directly
   return vaddr on success, and pass vaddr to free_pages on failure.
2. So, we can directly transparent pass vaddr from __dma_free to
   swiotlb_free_coherent, keep consistent with swiotlb_alloc_coherent.

This patch have no functional change, but can obtain a bit performance
improvement.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 arch/arm64/mm/dma-mapping.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a6e757c..b2f2834 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -187,8 +187,6 @@ static void __dma_free(struct device *dev, size_t size,
 		       void *vaddr, dma_addr_t dma_handle,
 		       struct dma_attrs *attrs)
 {
-	void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
-
 	size = PAGE_ALIGN(size);

 	if (!is_device_dma_coherent(dev)) {
@@ -196,7 +194,7 @@ static void __dma_free(struct device *dev, size_t size,
 			return;
 		vunmap(vaddr);
 	}
-	__dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
+	__dma_free_coherent(dev, size, vaddr, dma_handle, attrs);
 }

 static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,
--
2.5.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-18  1:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-15  2:12 [PATCH 1/1] arm64/dma-mapping: remove an unnecessary conversion Zhen Lei
2016-03-15 15:37 ` Catalin Marinas
2016-03-16  1:56   ` Leizhen (ThunderTown)
2016-03-17 11:06     ` Leizhen (ThunderTown)
2016-03-17 11:59       ` Catalin Marinas
2016-03-18  1:17         ` Leizhen (ThunderTown)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox