From: Robin Murphy <robin.murphy@arm.com>
To: Douglas Anderson <dianders@chromium.org>,
linux@arm.linux.org.uk, mchehab@osg.samsung.com,
tfiga@chromium.org, m.szyprowski@samsung.com
Cc: pawel@osciak.com, Dmitry Torokhov <dmitry.torokhov@gmail.com>,
hch@infradead.org, corbet@lwn.net, akpm@linux-foundation.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/5] common: DMA-mapping: add DMA_ATTR_ALLOC_SINGLE_PAGES attribute
Date: Wed, 13 Jan 2016 12:36:56 +0000 [thread overview]
Message-ID: <569644E8.2020600@arm.com> (raw)
In-Reply-To: <1452533428-12762-3-git-send-email-dianders@chromium.org>
On 11/01/16 17:30, Douglas Anderson wrote:
> This patch adds the DMA_ATTR_ALLOC_SINGLE_PAGES attribute to the
> DMA-mapping subsystem.
>
> This attribute can be used as a hint to the DMA-mapping subsystem that
> it's likely not worth it to try to allocate large pages behind the
> scenes. Large pages are likely to make an IOMMU TLB work more
> efficiently but may not be worth it. See the Documentation contained in
> this patch for more details about this attribute and when to use it.
>
> Note that the name of the hint (DMA_ATTR_ALLOC_SINGLE_PAGES) is loosely
> based on the name MADV_NOHUGEPAGE. Just as there is MADV_NOHUGEPAGE
> vs. MADV_HUGEPAGE we could also add an "opposite" attribute to
> DMA_ATTR_ALLOC_SINGLE_PAGES. Without having the "opposite" attribute
> the lack of DMA_ATTR_ALLOC_SINGLE_PAGES means "use your best judgement
> about whether to use small pages or large pages".
I did ponder the discussion on v4 over the weekend and arrived at
DMA_ATTR_LOW_ORDER_ALLOC and a shorter, more generalised description,
but ALLOC_SINGLE_PAGES seems just as good to me.
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Thanks,
Robin.
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Changes in v6:
> - renamed DMA_ATTR_NO_HUGE_PAGE to DMA_ATTR_ALLOC_SINGLE_PAGES
>
> Changes in v5:
> - renamed DMA_ATTR_NOHUGEPAGE to DMA_ATTR_NO_HUGE_PAGE
> - s/ping ping/ping pong/
>
> Changes in v4:
> - renamed DMA_ATTR_SEQUENTIAL to DMA_ATTR_NOHUGEPAGE
> - added Marek's ack
>
> Changes in v3:
> - add DMA_ATTR_SEQUENTIAL attribute new for v3
>
> Changes in v2: None
>
> Documentation/DMA-attributes.txt | 23 +++++++++++++++++++++++
> include/linux/dma-attrs.h | 1 +
> 2 files changed, 24 insertions(+)
>
> diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt
> index 18dc52c4f2a0..69b7b65ab516 100644
> --- a/Documentation/DMA-attributes.txt
> +++ b/Documentation/DMA-attributes.txt
> @@ -100,3 +100,26 @@ allocated by dma_alloc_attrs() function from individual pages if it can
> be mapped as contiguous chunk into device dma address space. By
> specifying this attribute the allocated buffer is forced to be contiguous
> also in physical memory.
> +
> +DMA_ATTR_ALLOC_SINGLE_PAGES
> +------------------------
> +
> +This is a hint to the DMA-mapping subsystem that it's probably not worth
> +the time to try to allocate memory to in a way that gives better TLB
> +efficiency (AKA it's not worth trying to build the mapping out of larger
> +pages). You might want to specify this if:
> +- You know that the accesses to this memory won't thrash the TLB.
> + You might know that the accesses are likely to be sequential or
> + that they aren't sequential but it's unlikely you'll ping-pong
> + between many addresses that are likely to be in different physical
> + pages.
> +- You know that the penalty of TLB misses while accessing the
> + memory will be small enough to be inconsequential. If you are
> + doing a heavy operation like decryption or decompression this
> + might be the case.
> +- You know that the DMA mapping is fairly transitory. If you expect
> + the mapping to have a short lifetime then it may be worth it to
> + optimize allocation (avoid coming up with large pages) instead of
> + getting the slight performance win of larger pages.
> +Setting this hint doesn't guarantee that you won't get huge pages, but it
> +means that we won't try quite as hard to get them.
> diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
> index 99c0be00b47c..5246239a4953 100644
> --- a/include/linux/dma-attrs.h
> +++ b/include/linux/dma-attrs.h
> @@ -18,6 +18,7 @@ enum dma_attr {
> DMA_ATTR_NO_KERNEL_MAPPING,
> DMA_ATTR_SKIP_CPU_SYNC,
> DMA_ATTR_FORCE_CONTIGUOUS,
> + DMA_ATTR_ALLOC_SINGLE_PAGES,
> DMA_ATTR_MAX,
> };
>
>
next prev parent reply other threads:[~2016-01-13 12:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 17:30 [PATCH v6 0/5] dma-mapping: Patches for speeding up allocation Douglas Anderson
2016-01-11 17:30 ` [PATCH v6 1/5] ARM: dma-mapping: Optimize allocation Douglas Anderson
2016-01-13 12:23 ` Robin Murphy
2016-01-11 17:30 ` [PATCH v6 2/5] common: DMA-mapping: add DMA_ATTR_ALLOC_SINGLE_PAGES attribute Douglas Anderson
2016-01-13 12:36 ` Robin Murphy [this message]
2016-01-11 17:30 ` [PATCH v6 3/5] ARM: dma-mapping: Use DMA_ATTR_ALLOC_SINGLE_PAGES hint to optimize alloc Douglas Anderson
2016-01-11 17:30 ` [PATCH v6 4/5] videobuf2-dc: Let drivers specify DMA attrs Douglas Anderson
2016-02-01 11:40 ` Mauro Carvalho Chehab
2016-02-01 13:29 ` Marek Szyprowski
2016-02-01 21:37 ` Doug Anderson
2016-02-17 17:00 ` Hans Verkuil
2016-02-17 17:26 ` Doug Anderson
2016-02-18 5:58 ` Tomasz Figa
2016-01-11 17:30 ` [PATCH v6 5/5] s5p-mfc: Set DMA_ATTR_ALLOC_SINGLE_PAGES Douglas Anderson
2016-01-26 23:31 ` [PATCH v6 0/5] dma-mapping: Patches for speeding up allocation Javier Martinez Canillas
2016-01-26 23:59 ` Andrew Morton
2016-01-27 0:39 ` Doug Anderson
2016-01-29 21:52 ` Olof Johansson
2016-01-29 21:58 ` Doug Anderson
2016-01-29 22:14 ` Doug Anderson
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=569644E8.2020600@arm.com \
--to=robin.murphy@arm.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hch@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@osg.samsung.com \
--cc=pawel@osciak.com \
--cc=tfiga@chromium.org \
/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
Powered by JetHome