linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	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 18:58:52 -0700	[thread overview]
Message-ID: <afa4392a-01e1-5daf-4cdb-e92d708b85e1@nvidia.com> (raw)
In-Reply-To: <20220907163408.f9a9152314d33afc74cb1f0c@linux-foundation.org>

On 9/7/22 16:34, Andrew Morton wrote:
> 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;

Wow, good point. And it's been doing that for a *long* time!

>>   			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.
> 
> 

With that re-worded commit description, please feel to add

Reviewed-by: John Hubbard <jhubbard@nvidia.com>


thanks,
-- 
John Hubbard
NVIDIA



      reply	other threads:[~2022-09-08  1:55 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
2022-09-08  1:58   ` John Hubbard [this message]

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=afa4392a-01e1-5daf-4cdb-e92d708b85e1@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=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