linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: hui yang <yanghui.def@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, YangHui <yanghui.def@gmail.com>
Subject: [PATCH 26/26] mm page_fault: Reduce code complexity
Date: Wed, 27 May 2020 18:33:30 +0800	[thread overview]
Message-ID: <1590575610-4546-1-git-send-email-yanghui.def@gmail.com> (raw)

From: YangHui <yanghui.def@gmail.com>

if pte_alloc_one fail alloc a page, do_fault_around will return 0.
and in do_read_fault()->__do_fault(), it also pte_alloc_one a page.
if pte_alloc_one failed to alloc a page,it will return VM_FAULT_OOM.
To reduce code complexity,if alloc failed we return VM_FAULT_OOM.

Signed-off-by: YangHui <yanghui.def@gmail.com>
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index f703fe8..b104879 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3800,7 +3800,7 @@ 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)
-			goto out;
+			return VM_FAULT_OOM;
 		smp_wmb(); /* See comment in __pte_alloc() */
 	}
 
-- 
2.7.4



             reply	other threads:[~2020-05-27 10:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 10:33 hui yang [this message]
2020-05-27 17:13 ` [PATCH 26/26] 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=1590575610-4546-1-git-send-email-yanghui.def@gmail.com \
    --to=yanghui.def@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.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).