]> git.dujemihanovic.xyz Git - linux.git/commitdiff
hugetlb: use a folio in free_hpage_workfn()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 24 Aug 2023 14:13:23 +0000 (15:13 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Oct 2023 17:32:31 +0000 (10:32 -0700)
Patch series "Small hugetlb cleanups", v2.

Some trivial folio conversions

This patch (of 3):

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.

Link: https://lkml.kernel.org/r/20230824141325.2704553-1-willy@infradead.org
Link: https://lkml.kernel.org/r/20230824141325.2704553-2-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c

index 4e276466d6aa421cd5e7d1f9bc8d6e5c00d916aa..7a6fe4f137779feda523a5aa842c32191469a86d 100644 (file)
@@ -1787,22 +1787,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();
        }