summaryrefslogtreecommitdiff
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2021-05-05 04:33:31 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-05-05 21:27:20 +0300
commitd83e6c8a9b65876b0dcd11ca25e8c39bd7bb1a1c (patch)
treee6fbe475efec7f0a2277c65fdb9d1b947c5628b6 /mm/hugetlb.c
parent5c8ecb131a655e775287380428ac1c764c117ee6 (diff)
downloadlinux-d83e6c8a9b65876b0dcd11ca25e8c39bd7bb1a1c.tar.xz
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: Miaohe Lin <linmiaohe@huawei.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c3d47af59137..c8f0a38588ba 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4395,13 +4395,10 @@ retry:
* 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;
- }
+ ret = 0;
+ if (huge_pte_none(huge_ptep_get(ptep)))
+ ret = vmf_error(PTR_ERR(page));
spin_unlock(ptl);
- ret = vmf_error(PTR_ERR(page));
goto out;
}
clear_huge_page(page, address, pages_per_huge_page(h));