linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Chen Wandun <chenwandun@huawei.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<wangkefeng.wang@huawei.com>
Subject: Re: [PATCH] mm: avoid unnecessary page table walk for __get_user_pages
Date: Wed, 7 Sep 2022 16:34:08 -0700	[thread overview]
Message-ID: <20220907163408.f9a9152314d33afc74cb1f0c@linux-foundation.org> (raw)
In-Reply-To: <20220906024401.133336-1-chenwandun@huawei.com>

On Tue, 6 Sep 2022 10:44:01 +0800 Chen Wandun <chenwandun@huawei.com> wrote:

> It is no need to walk page table and find pages if faultin_page success
> and __get_user_pages does't care pages at all, so directly handle next
> page.
>
> ...
>
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -1198,7 +1198,10 @@ static long __get_user_pages(struct mm_struct *mm,
>  					   PTR_ERR(page) == -EMLINK, locked);
>  			switch (ret) {
>  			case 0:
> -				goto retry;
> +				if (pages)
> +					goto retry;
> +				else
> +					goto next_page;
>  			case -EBUSY:
>  			case -EAGAIN:
>  				ret = 0;

Looks right to me.  I redid the changelog somewhat:

: There is no need to walk page tables and find pages if faultin_page)_
: succeeds and __get_user_pages)_ doesn't care about populating the pages[]
: array.  So directly go on to handle the next page.



  reply	other threads:[~2022-09-07 23:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  2:44 Chen Wandun
2022-09-07 23:34 ` Andrew Morton [this message]
2022-09-08  1:58   ` 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=20220907163408.f9a9152314d33afc74cb1f0c@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chenwandun@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangkefeng.wang@huawei.com \
    /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