From: Catalin Marinas <catalin.marinas@arm.com>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Will Deacon <will.deacon@arm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Zefan Li <lizefan@huawei.com>, Xinwei Hu <huxinwei@huawei.com>,
Tianhong Ding <dingtianhong@huawei.com>,
Hanjun Guo <guohanjun@huawei.com>
Subject: Re: [PATCH 1/1] arm64/dma-mapping: remove an unnecessary conversion
Date: Tue, 15 Mar 2016 15:37:58 +0000 [thread overview]
Message-ID: <20160315153757.GF12311@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <1458007931-14432-1-git-send-email-thunder.leizhen@huawei.com>
On Tue, Mar 15, 2016 at 10:12:11AM +0800, Zhen Lei wrote:
> 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,
I don't think so.
> but can obtain a bit performance improvement.
Have you actually measured it?
> 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);
> }
What happens when !is_device_dma_coherent(dev)? (hint: read two lines
above __dma_free_coherent).
--
Catalin
next prev parent reply other threads:[~2016-03-15 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 2:12 Zhen Lei
2016-03-15 15:37 ` Catalin Marinas [this message]
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160315153757.GF12311@e104818-lin.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=dingtianhong@huawei.com \
--cc=guohanjun@huawei.com \
--cc=huxinwei@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=thunder.leizhen@huawei.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®