Skip to content

Commit

Permalink
thp: clear page compound
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrea Arcangeli authored and Linus Torvalds committed Jan 14, 2011
1 parent 91a4ee2 commit 4e6af67
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion include/linux/page-flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,21 @@ static inline void set_page_writeback(struct page *page)
* tests can be used in performance sensitive paths. PageCompound is
* generally not used in hot code paths.
*/
__PAGEFLAG(Head, head)
__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
__PAGEFLAG(Tail, tail)

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

}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static inline void ClearPageCompound(struct page *page)
{
BUG_ON(!PageHead(page));
ClearPageHead(page);
}
#endif
#else
/*
* Reduce page flag use as much as possible by overlapping
Expand Down Expand Up @@ -392,6 +399,14 @@ static inline void __ClearPageTail(struct page *page)
page->flags &= ~PG_head_tail_mask;
}

#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static inline void ClearPageCompound(struct page *page)
{
BUG_ON((page->flags & PG_head_tail_mask) != (1 << PG_compound));
clear_bit(PG_compound, &page->flags);
}
#endif

#endif /* !PAGEFLAGS_EXTENDED */

#ifdef CONFIG_MMU
Expand Down

0 comments on commit 4e6af67

Please sign in to comment.