[RFC PATCH 1/6] mm: Expose clear_huge_page() unconditionally

Ryan Roberts ryan.roberts at arm.com
Fri Mar 17 03:57:57 PDT 2023


In preparation for extending vma_alloc_zeroed_movable_folio() to
allocate a arbitrary order folio, expose clear_huge_page()
unconditionally, so that it can be used to zero the allocated folio.

Signed-off-by: Ryan Roberts <ryan.roberts at arm.com>
---
 include/linux/mm.h | 3 ++-
 mm/memory.c        | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1f79667824eb..cdb8c6031d0f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3538,10 +3538,11 @@ enum mf_action_page_type {
  */
 extern const struct attribute_group memory_failure_attr_group;

-#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
 extern void clear_huge_page(struct page *page,
 			    unsigned long addr_hint,
 			    unsigned int pages_per_huge_page);
+
+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
 extern void copy_user_huge_page(struct page *dst, struct page *src,
 				unsigned long addr_hint,
 				struct vm_area_struct *vma,
diff --git a/mm/memory.c b/mm/memory.c
index f456f3b5049c..c08645908ee2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5628,7 +5628,6 @@ void __might_fault(const char *file, int line)
 EXPORT_SYMBOL(__might_fault);
 #endif

-#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
 /*
  * Process all subpages of the specified huge page with the specified
  * operation.  The target subpage will be processed last to keep its
@@ -5716,6 +5715,8 @@ void clear_huge_page(struct page *page,
 	process_huge_page(addr_hint, pages_per_huge_page, clear_subpage, page);
 }

+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
+
 static void copy_user_gigantic_page(struct page *dst, struct page *src,
 				    unsigned long addr,
 				    struct vm_area_struct *vma,
--
2.25.1




More information about the linux-arm-kernel mailing list