diff mbox series

[RFC,v2,30/47] hugetlb: add high-granularity check for hwpoison in fault path

Message ID 20221021163703.3218176-31-jthoughton@google.com (mailing list archive)
State New
Headers show
Series hugetlb: introduce HugeTLB high-granularity mapping | expand

Commit Message

James Houghton Oct. 21, 2022, 4:36 p.m. UTC
Because hwpoison swap entries may be placed beneath the hstate-level
PTE, we need to check for it separately (on top of the hstate-level PTE
check that remains).

Signed-off-by: James Houghton <jthoughton@google.com>
---
 mm/hugetlb.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8dba8d59ebe5..bb0005d57cab 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -6154,6 +6154,11 @@  vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 		mutex_unlock(&hugetlb_fault_mutex_table[hash]);
 		migration_entry_wait_huge(vma, &hpte);
 		return 0;
+	} else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) {
+		hugetlb_vma_unlock_read(vma);
+		mutex_unlock(&hugetlb_fault_mutex_table[hash]);
+		return VM_FAULT_HWPOISON_LARGE |
+			VM_FAULT_SET_HINDEX(hstate_index(h));
 	}
 
 	/* PTE markers should be handled the same way as none pte */