LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: mark.rutland@arm.com, sfr@canb.auug.org.au, kvm@vger.kernel.org,
	pbonzini@redhat.com, linux-mm@kvack.org, peterz@infradead.org,
	kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org,
	acme@kernel.org, rppt@linux.ibm.com,
	alexander.shishkin@linux.intel.com, mingo@redhat.com,
	aneesh.kumar@linux.ibm.com, John Hubbard <jhubbard@nvidia.com>,
	namhyung@kernel.org, akpm@linux-foundation.org,
	msuchanek@suse.de, linuxppc-dev@lists.ozlabs.org
Subject: Re: [linux-next RFC] mm/gup.c: Convert to use get_user_pages_fast_only()
Date: Sat, 23 May 2020 10:25:19 -0700
Message-ID: <20200523172519.GA17206@bombadil.infradead.org> (raw)
In-Reply-To: <1590252072-2793-1-git-send-email-jrdr.linux@gmail.com>

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?


  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 16:41 Souptick Joarder
2020-05-23 17:25 ` Matthew Wilcox [this message]
2020-05-23 19:35   ` Souptick Joarder
2020-05-23 22:18     ` John Hubbard

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=20200523172519.GA17206@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=jhubbard@nvidia.com \
    --cc=jrdr.linux@gmail.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=msuchanek@suse.de \
    --cc=namhyung@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@linux.ibm.com \
    --cc=sfr@canb.auug.org.au \
    /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

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git