From: Jan Kara <jack@suse.cz>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: john.hubbard@gmail.com, Matthew Wilcox <willy@infradead.org>,
Michal Hocko <mhocko@kernel.org>,
Christopher Lameter <cl@linux.com>,
Dan Williams <dan.j.williams@intel.com>, Jan Kara <jack@suse.cz>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
linux-rdma <linux-rdma@vger.kernel.org>,
linux-fsdevel@vger.kernel.org, John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH 1/2] mm: introduce put_user_page(), placeholder version
Date: Mon, 9 Jul 2018 18:11:54 +0200 [thread overview]
Message-ID: <20180709161154.46chzohwnzzbrtis@quack2.suse.cz> (raw)
In-Reply-To: <20180709155357.GA13496@ziepe.ca>
On Mon 09-07-18 09:53:57, Jason Gunthorpe wrote:
> On Mon, Jul 09, 2018 at 01:05:53AM -0700, john.hubbard@gmail.com wrote:
> > From: John Hubbard <jhubbard@nvidia.com>
> >
> > Introduces put_user_page(), which simply calls put_page().
> > This provides a safe way to update all get_user_pages*() callers,
> > so that they call put_user_page(), instead of put_page().
> >
> > Also adds release_user_pages(), a drop-in replacement for
> > release_pages(). This is intended to be easily grep-able,
> > for later performance improvements, since release_user_pages
> > is not batched like release_pages is, and is significantly
> > slower.
> >
> > Subsequent patches will add functionality to put_user_page().
> >
> > Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> > include/linux/mm.h | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index a0fbb9ffe380..db4a211aad79 100644
> > +++ b/include/linux/mm.h
> > @@ -923,6 +923,20 @@ static inline void put_page(struct page *page)
> > __put_page(page);
> > }
> >
> > +/* Placeholder version, until all get_user_pages*() callers are updated. */
> > +static inline void put_user_page(struct page *page)
> > +{
> > + put_page(page);
> > +}
> > +
> > +/* A drop-in replacement for release_pages(): */
> > +static inline void release_user_pages(struct page **pages,
> > + unsigned long npages)
> > +{
> > + while (npages)
> > + put_user_page(pages[--npages]);
> > +}
> > +
> > #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
> > #define SECTION_IN_PAGE_FLAGS
> > #endif
>
> Just as question: Do you think it is worthwhile to have a
> release_user_page_dirtied() helper as well?
>
> Ie to indicate that a pages that were grabbed under GUP FOLL_WRITE
> were actually written too?
>
> Keeps more of these unimportant details out of the drivers..
Yeah, I think that would be nice as well.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2018-07-09 16:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 8:05 [PATCH 0/2] mm/fs: put_user_page() proposal john.hubbard
2018-07-09 8:05 ` [PATCH 1/2] mm: introduce put_user_page(), placeholder version john.hubbard
2018-07-09 10:08 ` kbuild test robot
2018-07-09 18:48 ` John Hubbard
2018-07-09 15:53 ` Jason Gunthorpe
2018-07-09 16:11 ` Jan Kara [this message]
2018-07-09 8:05 ` [PATCH 2/2] goldfish_pipe/mm: convert to the new put_user_page() call john.hubbard
2018-07-09 8:49 ` [PATCH 0/2] mm/fs: put_user_page() proposal Nicholas Piggin
2018-07-09 16:08 ` Jan Kara
2018-07-09 17:16 ` Matthew Wilcox
2018-07-09 19:47 ` Jan Kara
2018-07-09 19:56 ` Jason Gunthorpe
2018-07-10 7:51 ` Jan Kara
2018-07-09 20:00 ` Matthew Wilcox
2018-07-10 8:21 ` Jan Kara
2018-07-09 16:27 ` Jan Kara
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=20180709161154.46chzohwnzzbrtis@quack2.suse.cz \
--to=jack@suse.cz \
--cc=cl@linux.com \
--cc=dan.j.williams@intel.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=john.hubbard@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).