path: root/lib
diff options
authorIra Weiny <>2021-05-04 18:40:03 -0700
committerLinus Torvalds <>2021-05-05 11:27:27 -0700
commit28961998f858114e51d2ae862065b858afcfa2b2 (patch)
tree08b7b8ba4d597b59aa24bb89b3c5e99ed19dce51 /lib
parentecfc2bda7aafc5c87b69a3d7a1fc1016dd21d5a7 (diff)
iov_iter: lift memzero_page() to highmem.h
Patch series "btrfs: Convert kmap/memset/kunmap to memzero_user()". Lifting memzero_user(), convert it to kmap_local_page() and then use it in btrfs. This patch (of 3): memzero_page() can replace the kmap/memset/kunmap pattern in other places in the code. While zero_user() has the same interface it is not the same call and its use should be limited and some of those calls may be better converted from zero_user() to memzero_page().[1] But that is not addressed in this series. Lift memzero_page() to highmem. [1] Link: Link: Signed-off-by: Ira Weiny <> Cc: Alexander Viro <> Cc: David Sterba <> Cc: Chris Mason <> Cc: Josef Bacik <> Cc: Chaitanya Kulkarni <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'lib')
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 61228a6c69f8..c701b7a187f2 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -5,6 +5,7 @@
#include <linux/fault-inject-usercopy.h>
#include <linux/uio.h>
#include <linux/pagemap.h>
+#include <linux/highmem.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/splice.h>
@@ -507,13 +508,6 @@ void iov_iter_init(struct iov_iter *i, unsigned int direction,
-static void memzero_page(struct page *page, size_t offset, size_t len)
- char *addr = kmap_atomic(page);
- memset(addr + offset, 0, len);
- kunmap_atomic(addr);
static inline bool allocated(struct pipe_buffer *buf)
return buf->ops == &default_pipe_buf_ops;