[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161026155021.20892-3-brian.boylston@hpe.com>
Date: Wed, 26 Oct 2016 10:50:20 -0500
From: Brian Boylston <brian.boylston@....com>
To: linux-nvdimm@...ts.01.org
Cc: linux-kernel@...r.kernel.org, toshi.kani@....com,
oliver.moreno@....com, Brian Boylston <brian.boylston@....com>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Al Viro <viro@...IV.linux.org.uk>,
Dan Williams <dan.j.williams@...el.com>
Subject: [PATCH v2 2/3] use a nocache copy for bvecs and kvecs in copy_from_iter_nocache()
Update copy_from_iter_nocache() to use memcpy_nocache()
for bvecs and kvecs.
Cc: Ross Zwisler <ross.zwisler@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: <x86@...nel.org>
Cc: Al Viro <viro@...IV.linux.org.uk>
Cc: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Brian Boylston <brian.boylston@....com>
Reviewed-by: Toshi Kani <toshi.kani@....com>
Reported-by: Oliver Moreno <oliver.moreno@....com>
---
lib/iov_iter.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 7e3138c..71e4531 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -342,6 +342,13 @@ static void memcpy_from_page(char *to, struct page *page, size_t offset, size_t
kunmap_atomic(from);
}
+static void memcpy_from_page_nocache(char *to, struct page *page, size_t offset, size_t len)
+{
+ char *from = kmap_atomic(page);
+ memcpy_nocache(to, from + offset, len);
+ kunmap_atomic(from);
+}
+
static void memcpy_to_page(struct page *page, size_t offset, const char *from, size_t len)
{
char *to = kmap_atomic(page);
@@ -392,9 +399,10 @@ size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i)
iterate_and_advance(i, bytes, v,
__copy_from_user_nocache((to += v.iov_len) - v.iov_len,
v.iov_base, v.iov_len),
- memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
- v.bv_offset, v.bv_len),
- memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
+ memcpy_from_page_nocache((to += v.bv_len) - v.bv_len,
+ v.bv_page, v.bv_offset, v.bv_len),
+ memcpy_nocache((to += v.iov_len) - v.iov_len,
+ v.iov_base, v.iov_len)
)
return bytes;
--
2.8.3
Powered by blists - more mailing lists