Commit 3ec145f9 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

hugetlb: use a folio in free_hpage_workfn()

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.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent fde1c4ec
...@@ -1787,22 +1787,22 @@ static void free_hpage_workfn(struct work_struct *work) ...@@ -1787,22 +1787,22 @@ static void free_hpage_workfn(struct work_struct *work)
node = llist_del_all(&hpage_freelist); node = llist_del_all(&hpage_freelist);
while (node) { while (node) {
struct page *page; struct folio *folio;
struct hstate *h; struct hstate *h;
page = container_of((struct address_space **)node, folio = container_of((struct address_space **)node,
struct page, mapping); struct folio, mapping);
node = node->next; node = node->next;
page->mapping = NULL; folio->mapping = NULL;
/* /*
* The VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio) in * The VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio) in
* folio_hstate() is going to trigger because a previous call to * folio_hstate() is going to trigger because a previous call to
* remove_hugetlb_folio() will clear the hugetlb bit, so do * remove_hugetlb_folio() will clear the hugetlb bit, so do
* not use folio_hstate() directly. * 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(); cond_resched();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment