diff mbox series

[1/3] hugetlb: Use a folio in free_hpage_workfn()

Message ID 20230822162808.4131399-1-willy@infradead.org (mailing list archive)
State New
Headers show
Series [1/3] hugetlb: Use a folio in free_hpage_workfn() | expand

Commit Message

Matthew Wilcox Aug. 22, 2023, 4:28 p.m. UTC
update_and_free_hugetlb_folio puts the memory on hpage_freelist as a folio
so we can take it off the list as a folio.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
 mm/hugetlb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Mike Kravetz Aug. 23, 2023, 10:37 p.m. UTC | #1
On 08/22/23 17:28, Matthew Wilcox (Oracle) wrote:
> update_and_free_hugetlb_folio puts the memory on hpage_freelist as a folio
> so we can take it off the list as a folio.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> ---
>  mm/hugetlb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Thanks!

I was about to do this for another reason.  All 3 patches testing fine with
another series under development.

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Muchun Song Aug. 24, 2023, 2:58 a.m. UTC | #2
> On Aug 23, 2023, at 00:28, Matthew Wilcox (Oracle) <willy@infradead.org> wrote:
> 
> update_and_free_hugetlb_folio puts the memory on hpage_freelist as a folio
> so we can take it off the list as a folio.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a82c3104337e..d1c856628bac 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1786,22 +1786,22 @@  static void free_hpage_workfn(struct work_struct *work)
 	node = llist_del_all(&hpage_freelist);
 
 	while (node) {
-		struct page *page;
+		struct folio *folio;
 		struct hstate *h;
 
-		page = container_of((struct address_space **)node,
-				     struct page, mapping);
+		folio = container_of((struct address_space **)node,
+				     struct folio, mapping);
 		node = node->next;
-		page->mapping = NULL;
+		folio->mapping = NULL;
 		/*
 		 * The VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio) in
 		 * folio_hstate() is going to trigger because a previous call to
 		 * remove_hugetlb_folio() will clear the hugetlb bit, so do
 		 * not use folio_hstate() directly.
 		 */
-		h = size_to_hstate(page_size(page));
+		h = size_to_hstate(folio_size(folio));
 
-		__update_and_free_hugetlb_folio(h, page_folio(page));
+		__update_and_free_hugetlb_folio(h, folio);
 
 		cond_resched();
 	}