Skip to content

Commit

Permalink
mm/hugetlb: set head flag before setting compound_order in __prep_com…
Browse files Browse the repository at this point in the history
…pound_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/20221212225529.22493-1-sidhartha.kumar@oracle.com
Fixes: d1c6095 ("mm/hugetlb: convert hugetlb prep functions to folios")
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reported-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Sidhartha Kumar authored and Andrew Morton committed Dec 13, 2022
1 parent c474548 commit c45bc55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,10 +1805,10 @@ static bool __prep_compound_gigantic_folio(struct folio *folio,
int nr_pages = 1 << order;
struct page *p;

/* we rely on prep_new_hugetlb_folio to set the destructor */
folio_set_compound_order(folio, order);
__folio_clear_reserved(folio);
__folio_set_head(folio);
/* we rely on prep_new_hugetlb_folio to set the destructor */
folio_set_compound_order(folio, order);
for (i = 0; i < nr_pages; i++) {
p = folio_page(folio, i);

Expand Down

0 comments on commit c45bc55

Please sign in to comment.