Skip to content

Commit c45bc55

Browse files
sidkumar99akpm00
authored andcommitted
mm/hugetlb: set head flag before setting compound_order in __prep_compound_gigantic_folio
folio_set_compound_order() checks if the passed in folio is a large folio. A large folio is indicated by the PG_head flag. Call __folio_set_head() before setting the order. Link: https://lkml.kernel.org/r/[email protected] Fixes: d1c6095 ("mm/hugetlb: convert hugetlb prep functions to folios") Signed-off-by: Sidhartha Kumar <[email protected]> Reported-by: David Hildenbrand <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent c474548 commit c45bc55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/hugetlb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,10 +1805,10 @@ static bool __prep_compound_gigantic_folio(struct folio *folio,
18051805
int nr_pages = 1 << order;
18061806
struct page *p;
18071807

1808-
/* we rely on prep_new_hugetlb_folio to set the destructor */
1809-
folio_set_compound_order(folio, order);
18101808
__folio_clear_reserved(folio);
18111809
__folio_set_head(folio);
1810+
/* we rely on prep_new_hugetlb_folio to set the destructor */
1811+
folio_set_compound_order(folio, order);
18121812
for (i = 0; i < nr_pages; i++) {
18131813
p = folio_page(folio, i);
18141814

0 commit comments

Comments
 (0)