From: hui yang <yanghui.def@gmail.com>
To: willy@infradead.org
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
YangHui <yanghui.def@gmail.com>
Subject: [PATCH] mm page_fault: Reduce code complexity
Date: Thu, 28 May 2020 19:01:39 +0800 [thread overview]
Message-ID: <1590663699-4541-1-git-send-email-yanghui.def@gmail.com> (raw)
From: YangHui <yanghui.def@gmail.com>
if pte_alloc_one failed alloc a page, do_fault_around will return 0.
and it will come into __do_fault(), it also pte_alloc_one a page.
in __do_fault and do_fault_around, pte_alloc_one did the same thing,
if do_fault_around alloc page filed,we just let it return. there is
no need to come into __do_fault to do repetitive pte_alloc_one.
Signed-off-by: YangHui <yanghui.def@gmail.com>
---
mm/memory.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/memory.c b/mm/memory.c
index f703fe8..a2d50a9 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3799,8 +3799,10 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf)
if (pmd_none(*vmf->pmd)) {
vmf->prealloc_pte = pte_alloc_one(vmf->vma->vm_mm);
- if (!vmf->prealloc_pte)
+ if (!vmf->prealloc_pte) {
+ ret = VM_FAULT_OOM;
goto out;
+ }
smp_wmb(); /* See comment in __pte_alloc() */
}
--
2.7.4
next reply other threads:[~2020-05-28 11:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 11:01 hui yang [this message]
2020-05-28 11:45 ` [PATCH] mm page_fault: Reduce code complexity Matthew Wilcox
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=1590663699-4541-1-git-send-email-yanghui.def@gmail.com \
--to=yanghui.def@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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).