Skip to content

Commit 4e6af67

Browse files
aarcange-rhtorvalds
authored andcommitted
thp: clear page compound
split_huge_page must transform a compound page to a regular page and needs ClearPageCompound. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Acked-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 91a4ee2 commit 4e6af67

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎include/linux/page-flags.h‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,21 @@ static inline void set_page_writeback(struct page *page)
347347
* tests can be used in performance sensitive paths. PageCompound is
348348
* generally not used in hot code paths.
349349
*/
350-
__PAGEFLAG(Head, head)
350+
__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
351351
__PAGEFLAG(Tail, tail)
352352

353353
static inline int PageCompound(struct page *page)
354354
{
355355
return page->flags & ((1L << PG_head) | (1L << PG_tail));
356356

357357
}
358+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
359+
static inline void ClearPageCompound(struct page *page)
360+
{
361+
BUG_ON(!PageHead(page));
362+
ClearPageHead(page);
363+
}
364+
#endif
358365
#else
359366
/*
360367
* Reduce page flag use as much as possible by overlapping
@@ -392,6 +399,14 @@ static inline void __ClearPageTail(struct page *page)
392399
page->flags &= ~PG_head_tail_mask;
393400
}
394401

402+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
403+
static inline void ClearPageCompound(struct page *page)
404+
{
405+
BUG_ON((page->flags & PG_head_tail_mask) != (1 << PG_compound));
406+
clear_bit(PG_compound, &page->flags);
407+
}
408+
#endif
409+
395410
#endif /* !PAGEFLAGS_EXTENDED */
396411

397412
#ifdef CONFIG_MMU

0 commit comments

Comments
 (0)