mm page_fault: Reduce code complexity
Subsystems (2)
PATCH 26/26 mm page_fault: Reduce code complexity
From: YangHui <[email protected]>
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.
--- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory.c +1 -1
@@ -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() */ }
Signature · 1 line
2.7.4
Quoted 4 lines · hui yang
if
pte_alloc_onefail alloc a page,do_fault_aroundwill return 0. and in do_read_fault()->__do_fault(), it alsopte_alloc_onea page. ifpte_alloc_onefailed to alloc a page,it will returnVM_FAULT_OOM. To reduce code complexity,if alloc failed we returnVM_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.