* [PATCH 26/26] mm page_fault: Reduce code complexity
@ 2020-05-27 10:33 hui yang
2020-05-27 17:13 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: hui yang @ 2020-05-27 10:33 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, YangHui
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 26/26] mm page_fault: Reduce code complexity
2020-05-27 10:33 [PATCH 26/26] mm page_fault: Reduce code complexity hui yang
@ 2020-05-27 17:13 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2020-05-27 17:13 UTC (permalink / raw)
To: hui yang; +Cc: akpm, linux-mm
On Wed, May 27, 2020 at 06:33:30PM +0800, hui yang wrote:
> 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.
This doesn't reduce code complexity at all. You've made this error
different from every other error handled by this function because now
it returns directly instead of jumping to 'out:'. I can't understand
your explanation, and at first glance I'm not even sure this patch is
correct. Definitely not a simplification, so NAK with this justification.
The patch might be correct, but it'll need a lot better prose than this.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-27 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 10:33 [PATCH 26/26] mm page_fault: Reduce code complexity hui yang
2020-05-27 17:13 ` Matthew Wilcox
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).