From: YangHui <yanghui.def@xxxxxxxxx> 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@xxxxxxxxx> --- 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