lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220907163408.f9a9152314d33afc74cb1f0c@linux-foundation.org>
Date:   Wed, 7 Sep 2022 16:34:08 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Chen Wandun <chenwandun@...wei.com>
Cc:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <wangkefeng.wang@...wei.com>
Subject: Re: [PATCH] mm: avoid unnecessary page table walk for
 __get_user_pages

On Tue, 6 Sep 2022 10:44:01 +0800 Chen Wandun <chenwandun@...wei.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ