The patch titled Subject: mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2 has been added to the -mm tree. Its filename is mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: James Morse <james.morse@xxxxxxx> Subject: mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2 Added vm_fault_to_errno() call to faultin_page() as Naoya Horiguchi suggested. Link: http://lkml.kernel.org/r/20170525171035.16359-1-james.morse@xxxxxxx Signed-off-by: James Morse <james.morse@xxxxxxx> Acked-by: Punit Agrawal <punit.agrawal@xxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/gup.c | 10 ++++------ mm/hugetlb.c | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff -puN mm/gup.c~mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2 mm/gup.c --- a/mm/gup.c~mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2 +++ a/mm/gup.c @@ -795,12 +795,10 @@ retry: ret = handle_mm_fault(vma, address, fault_flags); major |= ret & VM_FAULT_MAJOR; if (ret & VM_FAULT_ERROR) { - if (ret & VM_FAULT_OOM) - return -ENOMEM; - if (ret & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE)) - return -EHWPOISON; - if (ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) - return -EFAULT; + int err = vm_fault_to_errno(ret, 0); + + if (err) + return err; BUG(); } diff -puN mm/hugetlb.c~mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2 mm/hugetlb.c --- a/mm/hugetlb.c~mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2 +++ a/mm/hugetlb.c @@ -4192,9 +4192,10 @@ long follow_hugetlb_page(struct mm_struc if (ret & VM_FAULT_ERROR) { int err = vm_fault_to_errno(ret, flags); - remainder = 0; if (err) return err; + + remainder = 0; break; } if (ret & VM_FAULT_RETRY) { _ Patches currently in -mm which might be from james.morse@xxxxxxx are mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified.patch mm-hugetlb-report-ehwpoison-not-efault-when-foll_hwpoison-is-specified-v2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html