[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200523172519.GA17206@bombadil.infradead.org>
Date: Sat, 23 May 2020 10:25:19 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Souptick Joarder <jrdr.linux@...il.com>
Cc: paulus@...abs.org, mpe@...erman.id.au, benh@...nel.crashing.org,
akpm@...ux-foundation.org, peterz@...radead.org, mingo@...hat.com,
acme@...nel.org, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, namhyung@...nel.org,
pbonzini@...hat.com, sfr@...b.auug.org.au, rppt@...ux.ibm.com,
msuchanek@...e.de, aneesh.kumar@...ux.ibm.com,
kvm-ppc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
kvm@...r.kernel.org, John Hubbard <jhubbard@...dia.com>
Subject: Re: [linux-next RFC] mm/gup.c: Convert to use
get_user_pages_fast_only()
On Sat, May 23, 2020 at 10:11:12PM +0530, Souptick Joarder wrote:
> Renaming the API __get_user_pages_fast() to get_user_pages_
> fast_only() to align with pin_user_pages_fast_only().
Please don't split a function name across lines. That messes
up people who are grepping for the function name in the changelog.
> As part of this we will get rid of write parameter.
> Instead caller will pass FOLL_WRITE to get_user_pages_fast_only().
> This will not change any existing functionality of the API.
>
> All the callers are changed to pass FOLL_WRITE.
>
> Updated the documentation of the API.
Everything you have done here is an improvement, and I'd be happy to
see it go in (after fixing the bug I note below).
But in reading through it, I noticed almost every user ...
> - if (__get_user_pages_fast(hva, 1, 1, &page) == 1) {
> + if (get_user_pages_fast_only(hva, 1, FOLL_WRITE, &page) == 1) {
passes '1' as the second parameter. So do we want to add:
static inline bool get_user_page_fast_only(unsigned long addr,
unsigned int gup_flags, struct page **pagep)
{
return get_user_pages_fast_only(addr, 1, gup_flags, pagep) == 1;
}
> @@ -2797,10 +2803,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
> * FOLL_FAST_ONLY is required in order to match the API description of
> * this routine: no fall back to regular ("slow") GUP.
> */
> - unsigned int gup_flags = FOLL_GET | FOLL_FAST_ONLY;
> -
> - if (write)
> - gup_flags |= FOLL_WRITE;
> + gup_flags = FOLL_GET | FOLL_FAST_ONLY;
Er ... gup_flags |=, surely?
Powered by blists - more mailing lists