[RFC,v1,3/7] mm: publish raw_hwp_page in mm.h

Message ID 20230428004139.2899856-4-jiaqiyan@google.com
State New
Headers
Series PAGE_SIZE Unmapping in Memory Failure Recovery for HugeTLB Pages |

Commit Message

Jiaqi Yan April 28, 2023, 12:41 a.m. UTC
  raw_hwp_page will be needed by HugeTLB to determine if a raw subpage
in a hugepage is poisoned and either should be unmapped or not
faulted in at PAGE_SIZE PTE level

Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
---
 include/linux/mm.h  | 16 ++++++++++++++++
 mm/memory-failure.c | 13 -------------
 2 files changed, 16 insertions(+), 13 deletions(-)
  

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9d3216b4284a..4496d7bdd3ea 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3522,6 +3522,22 @@  enum mf_action_page_type {
  */
 extern const struct attribute_group memory_failure_attr_group;
 
+#ifdef CONFIG_HUGETLB_PAGE
+/*
+ * Struct raw_hwp_page represents information about "raw error page",
+ * constructing singly linked list from ->_hugetlb_hwpoison field of folio.
+ */
+struct raw_hwp_page {
+	struct llist_node node;
+	struct page *page;
+};
+
+static inline struct llist_head *raw_hwp_list_head(struct folio *folio)
+{
+	return (struct llist_head *)&folio->_hugetlb_hwpoison;
+}
+#endif
+
 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
 extern void clear_huge_page(struct page *page,
 			    unsigned long addr_hint,
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index eb5579b6787e..48e62d04af17 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1826,19 +1826,6 @@  EXPORT_SYMBOL_GPL(mf_dax_kill_procs);
 #endif /* CONFIG_FS_DAX */
 
 #ifdef CONFIG_HUGETLB_PAGE
-/*
- * Struct raw_hwp_page represents information about "raw error page",
- * constructing singly linked list from ->_hugetlb_hwpoison field of folio.
- */
-struct raw_hwp_page {
-	struct llist_node node;
-	struct page *page;
-};
-
-static inline struct llist_head *raw_hwp_list_head(struct folio *folio)
-{
-	return (struct llist_head *)&folio->_hugetlb_hwpoison;
-}
 
 static unsigned long __folio_free_raw_hwp(struct folio *folio, bool move_flag)
 {