From: Chen Wandun <chenwandun@huawei.com>
To: <akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Cc: <wangkefeng.wang@huawei.com>, <chenwandun@huawei.com>
Subject: [PATCH] mm: avoid unnecessary page table walk for __get_user_pages
Date: Tue, 6 Sep 2022 10:44:01 +0800 [thread overview]
Message-ID: <20220906024401.133336-1-chenwandun@huawei.com> (raw)
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@huawei.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
next reply other threads:[~2022-09-06 2:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 2:44 Chen Wandun [this message]
2022-09-07 23:34 ` [PATCH] mm: avoid unnecessary page table walk for __get_user_pages Andrew Morton
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=20220906024401.133336-1-chenwandun@huawei.com \
--to=chenwandun@huawei.com \
--cc=akpm@linux-foundation.org \
--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;
as well as URLs for NNTP newsgroup(s).