[Hirsute][PATCH 1/2] Revert "mm: filemap: check if THP has hwpoisoned subpage for PMD page fault"
Kamal Mostafa
kamal at canonical.com
Mon Jan 10 17:31:43 UTC 2022
BugLink: https://bugs.launchpad.net/bugs/1956984
This reverts commit 327aa2137d989f278ece7e8e31c218dfb3416c35.
This Ubuntu backport is bogus (hunk applied to routine finish_fault()
should have been applied to do_set_pmd()). To be replaced by corrected
backport.
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
include/linux/page-flags.h | 23 -----------------------
mm/huge_memory.c | 2 --
mm/memory-failure.c | 14 --------------
mm/memory.c | 9 ---------
mm/page_alloc.c | 4 +---
5 files changed, 1 insertion(+), 51 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 9b85f492bf56..ec5d0290e0ee 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -168,15 +168,6 @@ enum pageflags {
/* Compound pages. Stored in first tail page's flags */
PG_double_map = PG_workingset,
-#ifdef CONFIG_MEMORY_FAILURE
- /*
- * Compound pages. Stored in first tail page's flags.
- * Indicates that at least one subpage is hwpoisoned in the
- * THP.
- */
- PG_has_hwpoisoned = PG_mappedtodisk,
-#endif
-
/* non-lru isolated movable page */
PG_isolated = PG_reclaim,
@@ -709,20 +700,6 @@ PAGEFLAG_FALSE(DoubleMap)
TESTSCFLAG_FALSE(DoubleMap)
#endif
-#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_TRANSPARENT_HUGEPAGE)
-/*
- * PageHasHWPoisoned indicates that at least one subpage is hwpoisoned in the
- * compound page.
- *
- * This flag is set by hwpoison handler. Cleared by THP split or free page.
- */
-PAGEFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND)
- TESTSCFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND)
-#else
-PAGEFLAG_FALSE(HasHWPoisoned)
- TESTSCFLAG_FALSE(HasHWPoisoned)
-#endif
-
/*
* For pages that are never mapped to userspace (and aren't PageSlab),
* page_type may be used. Because it is initialised to -1, we invert the
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index eab1ed3e9675..f735eb3755db 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2499,8 +2499,6 @@ static void __split_huge_page(struct page *page, struct list_head *list,
/* lock lru list/PageCompound, ref freezed by page_ref_freeze */
lruvec = lock_page_lruvec(head);
- ClearPageHasHWPoisoned(head);
-
for (i = nr - 1; i >= 1; i--) {
__split_huge_page_tail(head, i, lruvec, list);
/* Some pages can be beyond i_size: drop them from page cache */
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9890f822d692..5562b00db788 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1474,20 +1474,6 @@ int memory_failure(unsigned long pfn, int flags)
}
if (PageTransHuge(hpage)) {
- /*
- * The flag must be set after the refcount is bumped
- * otherwise it may race with THP split.
- * And the flag can't be set in get_hwpoison_page() since
- * it is called by soft offline too and it is just called
- * for !MF_COUNT_INCREASE. So here seems to be the best
- * place.
- *
- * Don't need care about the above error handling paths for
- * get_hwpoison_page() since they handle either free page
- * or unhandlable page. The refcount is bumped iff the
- * page is a valid handlable page.
- */
- SetPageHasHWPoisoned(hpage);
if (try_to_split_thp_page(p, "Memory Failure") < 0) {
action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED);
res = -EBUSY;
diff --git a/mm/memory.c b/mm/memory.c
index c5c4edd74b5c..f7d2fc871423 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3923,15 +3923,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf)
else
page = vmf->page;
- /*
- * Just backoff if any subpage of a THP is corrupted otherwise
- * the corrupted page may mapped by PMD silently to escape the
- * check. This kind of THP just can be PTE mapped. Access to
- * the corrupted subpage should trigger SIGBUS as expected.
- */
- if (unlikely(PageHasHWPoisoned(page)))
- return ret;
-
/*
* check even for read faults because we might have lost our CoWed
* page
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a65a76a7fb5a..132c85fa0913 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1236,10 +1236,8 @@ static __always_inline bool free_pages_prepare(struct page *page,
VM_BUG_ON_PAGE(compound && compound_order(page) != order, page);
- if (compound) {
+ if (compound)
ClearPageDoubleMap(page);
- ClearPageHasHWPoisoned(page);
- }
for (i = 1; i < (1 << order); i++) {
if (compound)
bad += free_tail_pages_check(page, page + i);
--
2.17.1
More information about the kernel-team
mailing list