[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190724042518.14363-3-jhubbard@nvidia.com>
Date: Tue, 23 Jul 2019 21:25:08 -0700
From: john.hubbard@...il.com
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Anna Schumaker <anna.schumaker@...app.com>,
"David S . Miller" <davem@...emloft.net>,
Dominique Martinet <asmadeus@...ewreck.org>,
Eric Van Hensbergen <ericvh@...il.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Jason Wang <jasowang@...hat.com>, Jens Axboe <axboe@...nel.dk>,
Latchesar Ionkov <lucho@...kov.net>,
"Michael S . Tsirkin" <mst@...hat.com>,
Miklos Szeredi <miklos@...redi.hu>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Christoph Hellwig <hch@....de>,
Matthew Wilcox <willy@...radead.org>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>, ceph-devel@...r.kernel.org,
kvm@...r.kernel.org, linux-block@...r.kernel.org,
linux-cifs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-nfs@...r.kernel.org, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org, samba-technical@...ts.samba.org,
v9fs-developer@...ts.sourceforge.net,
virtualization@...ts.linux-foundation.org,
Jérôme Glisse <jglisse@...hat.com>,
John Hubbard <jhubbard@...dia.com>, Jan Kara <jack@...e.cz>,
Dan Williams <dan.j.williams@...el.com>,
Johannes Thumshirn <jthumshirn@...e.de>,
Ming Lei <ming.lei@...hat.com>,
Dave Chinner <david@...morbit.com>
Subject: [PATCH 02/12] iov_iter: add helper to test if an iter would use GUP v2
From: Jérôme Glisse <jglisse@...hat.com>
Add a helper to test if call to iov_iter_get_pages*() with a given
iter would result in calls to GUP (get_user_pages*()). We want to
use different tracking of page references if they are coming from
GUP (get_user_pages*()) and thus we need to know when GUP is used
for a given iter.
Changes since Jérôme's original patch:
* iov_iter_get_pages_use_gup(): do not return true for the ITER_PIPE
case, because iov_iter_get_pages() calls pipe_get_pages(), which in
turn uses get_page(), not get_user_pages().
* Remove some obsolete code, as part of rebasing onto Linux 5.3.
* Fix up the kerneldoc comment to "Return:" rather than "Returns:",
and a few other grammatical tweaks.
Signed-off-by: Jérôme Glisse <jglisse@...hat.com>
Signed-off-by: John Hubbard <jhubbard@...dia.com>
Cc: linux-fsdevel@...r.kernel.org
Cc: linux-block@...r.kernel.org
Cc: linux-mm@...ck.org
Cc: John Hubbard <jhubbard@...dia.com>
Cc: Jan Kara <jack@...e.cz>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Johannes Thumshirn <jthumshirn@...e.de>
Cc: Christoph Hellwig <hch@....de>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Ming Lei <ming.lei@...hat.com>
Cc: Dave Chinner <david@...morbit.com>
Cc: Jason Gunthorpe <jgg@...pe.ca>
Cc: Matthew Wilcox <willy@...radead.org>
---
include/linux/uio.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index ab5f523bc0df..2a179af8e5a7 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -86,6 +86,17 @@ static inline unsigned char iov_iter_rw(const struct iov_iter *i)
return i->type & (READ | WRITE);
}
+/**
+ * iov_iter_get_pages_use_gup - report if iov_iter_get_pages(i) uses GUP
+ * @i: iterator
+ * Return: true if a call to iov_iter_get_pages*() with the iter provided in
+ * the argument would result in the use of get_user_pages*()
+ */
+static inline bool iov_iter_get_pages_use_gup(const struct iov_iter *i)
+{
+ return iov_iter_type(i) == ITER_IOVEC;
+}
+
/*
* Total number of bytes covered by an iovec.
*
--
2.22.0
Powered by blists - more mailing lists