Commit d83e6c8a authored by Miaohe Lin's avatar Miaohe Lin Committed by Linus Torvalds
Browse files

mm/hugetlb: simplify the code when alloc_huge_page() failed in hugetlb_no_page()

Rework the error handling code when alloc_huge_page() failed to remove
some duplicated code and simplify the code slightly.

Link: https://lkml.kernel.org/r/20210308112809.26107-5-linmiaohe@huawei.com


Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5c8ecb13
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -4395,13 +4395,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
			 * sure there really is no pte entry.
			 */
			ptl = huge_pte_lock(h, mm, ptep);
			if (!huge_pte_none(huge_ptep_get(ptep))) {
			ret = 0;
				spin_unlock(ptl);
				goto out;
			}
			spin_unlock(ptl);
			if (huge_pte_none(huge_ptep_get(ptep)))
				ret = vmf_error(PTR_ERR(page));
			spin_unlock(ptl);
			goto out;
		}
		clear_huge_page(page, address, pages_per_huge_page(h));