Re: [PATCH] mm: avoid unnecessary page table walk for __get_user_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/7/22 16:34, Andrew Morton wrote:
On Tue, 6 Sep 2022 10:44:01 +0800 Chen Wandun <chenwandun@xxxxxxxxxx> 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@xxxxxxxxxx>


thanks,
--
John Hubbard
NVIDIA





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux