mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED
commitad4b3fb7ff
upstream. Unfortunately with !CONFIG_PAGEFLAGS_EXTENDED, (!PageHead) is false, and (PageHead) is true, for tail pages. If this is indeed the intended behavior, which I doubt because it breaks cache cleaning on some ARM systems, then the nomenclature is highly problematic. This patch makes sure PageHead is only true for head pages and PageTail is only true for tail pages, and neither is true for non-compound pages. [ This buglet seems ancient - seems to have been introduced back in Apr 2008 in commit6a1e7f777f
: "pageflags: convert to the use of new macros". And the reason nobody noticed is because the PageHead() tests are almost all about just sanity-checking, and only used on pages that are actual page heads. The fact that the old code returned true for tail pages too was thus not really noticeable. - Linus ] Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu> Acked-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Will Deacon <Will.Deacon@arm.com> Cc: Steve Capper <Steve.Capper@arm.com> Cc: Christoph Lameter <cl@linux.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
711cf004f2
commit
25747cc458
1 changed files with 7 additions and 1 deletions
|
@ -361,7 +361,7 @@ static inline void ClearPageCompound(struct page *page)
|
|||
* pages on the LRU and/or pagecache.
|
||||
*/
|
||||
TESTPAGEFLAG(Compound, compound)
|
||||
__PAGEFLAG(Head, compound)
|
||||
__SETPAGEFLAG(Head, compound) __CLEARPAGEFLAG(Head, compound)
|
||||
|
||||
/*
|
||||
* PG_reclaim is used in combination with PG_compound to mark the
|
||||
|
@ -373,8 +373,14 @@ __PAGEFLAG(Head, compound)
|
|||
* PG_compound & PG_reclaim => Tail page
|
||||
* PG_compound & ~PG_reclaim => Head page
|
||||
*/
|
||||
#define PG_head_mask ((1L << PG_compound))
|
||||
#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
|
||||
|
||||
static inline int PageHead(struct page *page)
|
||||
{
|
||||
return ((page->flags & PG_head_tail_mask) == PG_head_mask);
|
||||
}
|
||||
|
||||
static inline int PageTail(struct page *page)
|
||||
{
|
||||
return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
|
||||
|
|
Loading…
Reference in a new issue