mm/hwpoison: dissolve error hugepages of file mapping
Subsystems (2)
PATCH 1/1 mm/hwpoison: dissolve error hugepages of file mapping
We handle error on hugetlb file with hugetlbfs_error_remove_page(), which removes the error hugepages from page cache. And with the HWPoison flag in head page, it is safe to free the error hugepages and dissolve it.
--- mm/memory-failure.c | 7 +++++++ 1 file changed, 7 insertions(+)
mm/memory-failure.c +7 -0
@@ -988,6 +988,13 @@ static int me_huge_page(struct page *p, unsigned long pfn)if (mapping) { res =truncate_error_page (hpage, pfn, mapping);unlock_page (hpage); +if (ret ==MF_RECOVERED ) { +put_page (hpage); +if (__page_handle_poison (p)) +page_ref_inc (p); +else + ret =MF_FAILED ; + } }else { res =MF_FAILED ;unlock_page (hpage);
Signature · 1 line
2.23.0
Quoted 4 lines · Bin Wang
We handle error on hugetlb file with
hugetlbfs_error_remove_page(), which removes the error hugepages from page cache. And with the HWPoison flag in head page, it is safe to free the error hugepages and dissolve it.
How is that safe? If you're going to dissolve the huge page, you need to figure out which subpage needs to have the HWPoison flag set.
Hi Matthew,
Quoted 2 lines · Matthew Wilcox
How is that safe? If you're going to dissolve the huge page, you need to figure out which subpage needs to have the HWPoison flag set.
Thanks for your review. The p that we pass to the __page_handle_poison() is the error subpage. And we will move the HWPoison flag to subpage in the dissolve_free_huge_page():
if (PageHWPoison(head) && page != head) {
SetPageHWPoison(page);
ClearPageHWPoison(head);
}Thanks,
Bin Wang