mm/hugetlb: add missing VM_FAULT_SET_HINDEX in hugetlb_wp
authorOscar Salvador <osalvador@suse.de>
Thu, 9 May 2024 10:01:48 +0000 (12:01 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 11 May 2024 22:41:37 +0000 (15:41 -0700)
commit 1cb9dc4b475c ("mm: hwpoison: support recovery from HugePage
copy-on-write faults") added support to use the mc variants when coping
hugetlb pages on CoW faults.

Add the missing VM_FAULT_SET_HINDEX, so the right si_addr_lsb will be
passed to userspace to report the extension of the faulty area.

Link: https://lkml.kernel.org/r/20240509100148.22384-3-osalvador@suse.de
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Acked-by: Peter Xu <peterx@redhat.com>
Acked-by: Axel Rasmussen <axelrasmussen@google.com>
Cc: Liu Shixin <liushixin2@huawei.com>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c

index 262456daf3274735e2edd9ba764c9830e4441a76..6be78e7d4f6e058ef1c72e54aa8fc2cadc76cc06 100644 (file)
@@ -6067,7 +6067,7 @@ retry_avoidcopy:
                goto out_release_all;
 
        if (copy_user_large_folio(new_folio, old_folio, vmf->real_address, vma)) {
-               ret = VM_FAULT_HWPOISON_LARGE;
+               ret = VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h));
                goto out_release_all;
        }
        __folio_mark_uptodate(new_folio);