From patchwork Tue Mar 15 02:12:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 63834 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp387347lbc; Mon, 14 Mar 2016 19:18:44 -0700 (PDT) X-Received: by 10.66.157.161 with SMTP id wn1mr42894791pab.146.1458008324045; Mon, 14 Mar 2016 19:18:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 75si3339749pfs.118.2016.03.14.19.18.43; Mon, 14 Mar 2016 19:18:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933550AbcCOCSm (ORCPT + 31 others); Mon, 14 Mar 2016 22:18:42 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:32455 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932809AbcCOCSj (ORCPT ); Mon, 14 Mar 2016 22:18:39 -0400 Received: from 172.24.1.137 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.137]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BXZ29802; Tue, 15 Mar 2016 10:18:33 +0800 (CST) Received: from localhost (10.177.23.164) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Tue, 15 Mar 2016 10:18:26 +0800 From: Zhen Lei To: Catalin Marinas , Will Deacon , linux-kernel CC: Zefan Li , Xinwei Hu , "Tianhong Ding" , Hanjun Guo , Zhen Lei Subject: [PATCH 1/1] arm64/dma-mapping: remove an unnecessary conversion Date: Tue, 15 Mar 2016 10:12:11 +0800 Message-ID: <1458007931-14432-1-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.56E770FC.00A4, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: feb7f62301bb54ab3f410d2602a19b6c Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/arm64/mm/dma-mapping.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.5.0 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,