Skip to contentSkip to conversation

mm-hugetlb-convert-move_hugetlb_state-to-folios.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Dec 1, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/hugetlb: convert move_hugetlb_state() to folios
has been removed from the -mm tree. Its filename was
mm-hugetlb-convert-move_hugetlb_state-to-folios.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Sidhartha Kumar <[email protected]>
Subject: mm/hugetlb: convert move_hugetlb_state() to folios
Date: Tue, 1 Nov 2022 15:30:59 -0700

Clean up unmap_and_move_huge_page() by converting move_hugetlb_state() to take in folios.

[[email protected]: fix CONFIG_HUGETLB_PAGE=n build]
Cc Aneesh Kumar K.V <[email protected]>
Cc Bui Quang Minh <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Miaohe Lin <[email protected]>
Cc Mina Almasry <[email protected]>

---

 include/linux/hugetlb.h |   11 ++++++++---
 mm/hugetlb.c            |   22 ++++++++++++----------
 mm/migrate.c            |    4 ++--
 3 files changed, 22 insertions(+), 15 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-hugetlb-convert-move_hugetlb_state-to-folios +8 -3
@@ -187,7 +187,7 @@ int get_hwpoison_huge_page(struct page *
 int get_huge_page_for_hwpoison(unsigned long pfn, int flags,
 				bool *migratable_cleared);
 void putback_active_hugepage(struct page *page);
-void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason);
+void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason);
 void free_huge_page(struct page *page);
 void hugetlb_fix_reserve_counts(struct inode *inode);
 extern struct mutex *hugetlb_fault_mutex_table;
@@ -407,8 +407,8 @@ static inline void putback_active_hugepa
 {
 }
 
-static inline void move_hugetlb_state(struct page *oldpage,
-					struct page *newpage, int reason)
+static inline void move_hugetlb_state(struct folio *old_folio,
+					struct folio *new_folio, int reason)
 {
 }
 
@@ -991,6 +991,11 @@ void hugetlb_unregister_node(struct node
 #else	/* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 
+static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio)
+{
+	return NULL;
+}
+
 static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
 {
 	return NULL;
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-convert-move_hugetlb_state-to-folios +12 -10
@@ -7324,15 +7324,15 @@ void putback_active_hugepage(struct page
 	put_page(page);
 }
 
-void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason)
+void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason)
 {
-	struct hstate *h = page_hstate(oldpage);
+	struct hstate *h = folio_hstate(old_folio);
 
-	hugetlb_cgroup_migrate(page_folio(oldpage), page_folio(newpage));
-	set_page_owner_migrate_reason(newpage, reason);
+	hugetlb_cgroup_migrate(old_folio, new_folio);
+	set_page_owner_migrate_reason(&new_folio->page, reason);
 
 	/*
-	 * transfer temporary state of the new huge page. This is
+	 * transfer temporary state of the new hugetlb folio. This is
 	 * reverse to other transitions because the newpage is going to
 	 * be final while the old one will be freed so it takes over
 	 * the temporary status.
@@ -7341,12 +7341,14 @@ void move_hugetlb_state(struct page *old
 	 * here as well otherwise the global surplus count will not match
 	 * the per-node's.
 	 */
-	if (HPageTemporary(newpage)) {
-		int old_nid = page_to_nid(oldpage);
-		int new_nid = page_to_nid(newpage);
+	if (folio_test_hugetlb_temporary(new_folio)) {
+		int old_nid = folio_nid(old_folio);
+		int new_nid = folio_nid(new_folio);
+
+
+		folio_set_hugetlb_temporary(old_folio);
+		folio_clear_hugetlb_temporary(new_folio);
 
-		SetHPageTemporary(oldpage);
-		ClearHPageTemporary(newpage);
 
 		/*
 		 * There is no need to transfer the per-node surplus state
mm/migrate.c renamed from mm/migrate.c~mm-hugetlb-convert-move_hugetlb_state-to-folios +2 -2
@@ -1298,7 +1298,7 @@ static int unmap_and_move_huge_page(new_
 	 * folio_mapping() set, hugetlbfs specific move page routine will not
 	 * be called and we could leak usage counts for subpools.
 	 */
-	if (hugetlb_page_subpool(hpage) && !folio_mapping(src)) {
+	if (hugetlb_folio_subpool(src) && !folio_mapping(src)) {
 		rc = -EBUSY;
 		goto out_unlock;
 	}
@@ -1348,7 +1348,7 @@ put_anon:
 		put_anon_vma(anon_vma);
 
 	if (rc == MIGRATEPAGE_SUCCESS) {
-		move_hugetlb_state(hpage, new_hpage, reason);
+		move_hugetlb_state(src, dst, reason);
 		put_new_page = NULL;
 	}
 

_

Patches currently in -mm which might be from [email protected] are

mm-add-folio-dtor-and-order-setter-functions.patch mm-hugetlb-convert-destroy_compound_gigantic_page-to-folios.patch mm-hugetlb-convert-dissolve_free_huge_page-to-folios.patch mm-hugetlb-convert-remove_hugetlb_page-to-folios.patch mm-hugetlb-convert-update_and_free_page-to-folios.patch mm-hugetlb-convert-add_hugetlb_page-to-folios-and-add-hugetlb_cma_folio.patch mm-hugetlb-convert-enqueue_huge_page-to-folios.patch mm-hugetlb-convert-free_gigantic_page-to-folios.patch mm-hugetlb-convert-hugetlb-prep-functions-to-folios.patch mm-hugetlb-change-hugetlb-allocation-functions-to-return-a-folio.patch