From: Douglas Anderson <dianders@chromium.org>
To: Russell King <linux@arm.linux.org.uk>
Cc: Robin Murphy <robin.murphy@arm.com>,
Tomasz Figa <tfiga@chromium.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Pawel Osciak <pawel@osciak.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Douglas Anderson <dianders@chromium.org>,
corbet@lwn.net, akpm@linux-foundation.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/3] common: DMA-mapping: add DMA_ATTR_SEQUENTIAL attribute
Date: Wed, 6 Jan 2016 11:36:44 -0800 [thread overview]
Message-ID: <1452109005-19517-3-git-send-email-dianders@chromium.org> (raw)
In-Reply-To: <1452109005-19517-1-git-send-email-dianders@chromium.org>
This patch adds the DMA_ATTR_SEQUENTIAL attribute to the DMA-mapping
subsystem.
This attribute can be used as a hint to the DMA-mapping subsystem that
access to memory will be mostly sequential. With mostly sequential
access TLB efficiency isn't as important, so the system may make
tradeoffs sacrificing TLB efficiency to gain other benefits.
It's expected that we will use this attribute as a hint that memory
allocation should be done page at a time instead of asking the memory
subsystem to try to give us as big of chunks as possible. Allocating a
page at a time sacrifices TLB efficiency but it is much quicker for the
memory subsystem to process and it also leaves big chunks of memory
available for other users to use.
The name of the hint (DMA_ATTR_SEQUENTIAL) is based on the name
MADV_SEQUENTIAL, which has the same meaning. If we have expected users,
we could also add DMA_ATTR_RANDOM to indicate that random access is
expected.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v3:
- add DMA_ATTR_SEQUENTIAL attribute new for v3
Changes in v2: None
Documentation/DMA-attributes.txt | 11 +++++++++++
include/linux/dma-attrs.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt
index 18dc52c4f2a0..467e1c5c9cdc 100644
--- a/Documentation/DMA-attributes.txt
+++ b/Documentation/DMA-attributes.txt
@@ -100,3 +100,14 @@ 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_SEQUENTIAL
+-------------------
+
+This is a hint to the DMA-mapping subsystem that access to the buffer
+will be mostly sequential instead of random access. The DMA-mapping
+subsystem might use this information to make decisions on how hard it
+will work to optimize TLB efficiency. If we know access is sequential
+and we don't have DMA_ATTR_FORCE_CONTIGUOUS then it's probably wiser
+for the DMA-mapping subsystem to allocate memory out of individual
+pages to avoid stressing the memory subsystem as much.
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h
index 99c0be00b47c..5777a2cec5f3 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_SEQUENTIAL,
DMA_ATTR_MAX,
};
--
2.6.0.rc2.230.g3dd15c0
next prev parent reply other threads:[~2016-01-06 19:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 19:36 [PATCH v3 0/3] dma-mapping: Patches for speeding up allocation Douglas Anderson
2016-01-06 19:36 ` [PATCH v3 1/3] ARM: dma-mapping: Optimize allocation Douglas Anderson
2016-01-06 19:36 ` Douglas Anderson [this message]
2016-01-06 19:36 ` [PATCH v3 3/3] ARM: dma-mapping: Use DMA_ATTR_SEQUENTIAL hint to optimize allocation Douglas Anderson
2016-01-07 13:52 ` [PATCH v3 0/3] dma-mapping: Patches for speeding up allocation Marek Szyprowski
2016-01-07 17:23 ` 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=1452109005-19517-3-git-send-email-dianders@chromium.org \
--to=dianders@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=pawel@osciak.com \
--cc=robin.murphy@arm.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
all inboxes | Powered by JetHome®