linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED
@ 2012-12-28 17:07 c.dall
  2012-12-28 17:18 ` [PATCH v2] " cdall
  2012-12-28 22:01 ` [PATCH] " Linus Torvalds
  0 siblings, 2 replies; 4+ messages in thread
From: c.dall @ 2012-12-28 17:07 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: cl, Christoffer Dall, Steve Capper, Will Deacon,
	Andrea Arcangeli, Linus Torvalds

From: Christoffer Dall <cdall@cs.columbia.edu>

Unfortunately with !CONFIG_PAGEFLAGS_EXTENDED, (!PageHead) is false, and
(PageHead) is true, for tail pages.  This breaks cache cleaning on some
ARM systems, and may cause other bugs.

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.

Cc: Steve Capper <steve.capper@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrea Arcangeli <arcange@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
---
 include/linux/page-flags.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5d1384..70473da 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -362,7 +362,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
@@ -374,8 +374,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);
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED
  2012-12-28 17:07 [PATCH] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED c.dall
@ 2012-12-28 17:18 ` cdall
  2012-12-28 22:01 ` [PATCH] " Linus Torvalds
  1 sibling, 0 replies; 4+ messages in thread
From: cdall @ 2012-12-28 17:18 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: cl, Christoffer Dall, Steve Capper, Will Deacon,
	Andrea Arcangeli, Linus Torvalds

From: Christoffer Dall <cdall@cs.columbia.edu>

Unfortunately with !CONFIG_PAGEFLAGS_EXTENDED, (!PageHead) is false, and
(PageHead) is true, for tail pages.  This breaks cache cleaning on some
ARM systems, and may cause other bugs.

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.

Cc: Steve Capper <steve.capper@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
---

Changes since v1:
 - Andrea's e-mail address was misspelled

 include/linux/page-flags.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5d1384..70473da 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -362,7 +362,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
@@ -374,8 +374,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);
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED
  2012-12-28 17:07 [PATCH] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED c.dall
  2012-12-28 17:18 ` [PATCH v2] " cdall
@ 2012-12-28 22:01 ` Linus Torvalds
  2012-12-28 22:20   ` Christoffer Dall
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2012-12-28 22:01 UTC (permalink / raw)
  To: c.dall
  Cc: linux-mm, Linux Kernel Mailing List, Christoph Lameter,
	Christoffer Dall, Steve Capper, Will Deacon, Andrea Arcangeli

On Fri, Dec 28, 2012 at 9:07 AM,  <c.dall@virtualopensystems.com> wrote:
> From: Christoffer Dall <cdall@cs.columbia.edu>
>
> Unfortunately with !CONFIG_PAGEFLAGS_EXTENDED, (!PageHead) is false, and
> (PageHead) is true, for tail pages.  This breaks cache cleaning on some
> ARM systems, and may cause other bugs.

So this already got committed earlier as commit ad4b3fb7ff99 ("mm: Fix
PageHead when !CONFIG_PAGEFLAGS_EXTENDED")

                    Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED
  2012-12-28 22:01 ` [PATCH] " Linus Torvalds
@ 2012-12-28 22:20   ` Christoffer Dall
  0 siblings, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2012-12-28 22:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-mm, Linux Kernel Mailing List, Christoph Lameter,
	Steve Capper, Will Deacon, Andrea Arcangeli

On Fri, Dec 28, 2012 at 5:01 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Fri, Dec 28, 2012 at 9:07 AM,  <c.dall@virtualopensystems.com> wrote:
>> From: Christoffer Dall <cdall@cs.columbia.edu>
>>
>> Unfortunately with !CONFIG_PAGEFLAGS_EXTENDED, (!PageHead) is false, and
>> (PageHead) is true, for tail pages.  This breaks cache cleaning on some
>> ARM systems, and may cause other bugs.
>
> So this already got committed earlier as commit ad4b3fb7ff99 ("mm: Fix
> PageHead when !CONFIG_PAGEFLAGS_EXTENDED")
>
>                     Linus

Sorry about the noise then, thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-28 22:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-28 17:07 [PATCH] mm: Fix PageHead when !CONFIG_PAGEFLAGS_EXTENDED c.dall
2012-12-28 17:18 ` [PATCH v2] " cdall
2012-12-28 22:01 ` [PATCH] " Linus Torvalds
2012-12-28 22:20   ` Christoffer Dall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox