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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220906024401.133336-1-chenwandun@huawei.com>
Date:   Tue, 6 Sep 2022 10:44:01 +0800
From:   Chen Wandun <chenwandun@...wei.com>
To:     <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>
CC:     <wangkefeng.wang@...wei.com>, <chenwandun@...wei.com>
Subject: [PATCH] mm: avoid unnecessary page table walk for __get_user_pages

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.

Signed-off-by: Chen Wandun <chenwandun@...wei.com>
---
 mm/gup.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/gup.c b/mm/gup.c
index 983e24fd4b70..c8de33cc37af 100644
--- 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;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ