linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-mm@kvack.org
Cc: Matthew Wilcox <mawilcox@microsoft.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Pavel Tatashin <pasha.tatashin@oracle.com>
Subject: [PATCH 3/8] mm: Turn PF_POISONED_CHECK into CheckPageInit
Date: Fri, 13 Apr 2018 21:31:40 -0700	[thread overview]
Message-ID: <20180414043145.3953-4-willy@infradead.org> (raw)
In-Reply-To: <20180414043145.3953-1-willy@infradead.org>

From: Matthew Wilcox <mawilcox@microsoft.com>

This is not a page flag policy, and should not have been documented as
such.  It's a debug check, so combine it with PagePoisoned into
CheckPageInit.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
 include/linux/mm.h         |  2 +-
 include/linux/page-flags.h | 21 ++++++++-------------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 4d1aff80669c..8b09adeed1f7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -907,7 +907,7 @@ static inline int page_to_nid(const struct page *page)
 {
 	struct page *p = (struct page *)page;
 
-	return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK;
+	return (CheckPageInit(p)->flags >> NODES_PGSHIFT) & NODES_MASK;
 }
 #endif
 
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 8588c4628a7d..393bb93b6b89 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -157,17 +157,15 @@ static __always_inline int PageCompound(struct page *page)
 }
 
 #define	PAGE_POISON_PATTERN	-1l
-static inline int PagePoisoned(const struct page *page)
+static __always_inline struct page *CheckPageInit(struct page *page)
 {
-	return page->flags == PAGE_POISON_PATTERN;
+	VM_BUG_ON_PGFLAGS(page->flags == PAGE_POISON_PATTERN, page);
+	return page;
 }
 
 /*
  * Page flags policies wrt compound pages
  *
- * PF_POISONED_CHECK
- *     check if this struct page poisoned/uninitialized
- *
  * PF_ANY:
  *     the page flag is relevant for small, head and tail pages.
  *
@@ -185,20 +183,17 @@ static inline int PagePoisoned(const struct page *page)
  * PF_NO_COMPOUND:
  *     the page flag is not relevant for compound pages.
  */
-#define PF_POISONED_CHECK(page) ({					\
-		VM_BUG_ON_PGFLAGS(PagePoisoned(page), page);		\
-		page; })
-#define PF_ANY(page, modify)	PF_POISONED_CHECK(page)
-#define PF_HEAD(page, modify)	PF_POISONED_CHECK(compound_head(page))
+#define PF_ANY(page, modify)	CheckPageInit(page)
+#define PF_HEAD(page, modify)	CheckPageInit(compound_head(page))
 #define PF_ONLY_HEAD(page, modify) ({					\
 		VM_BUG_ON_PGFLAGS(PageTail(page), page);		\
-		PF_POISONED_CHECK(page); })
+		CheckPageInit(page); })
 #define PF_TAIL_READ(page, modify) ({					\
 		VM_BUG_ON_PGFLAGS(modify && PageTail(page), page);	\
-		PF_POISONED_CHECK(compound_head(page)); })
+		CheckPageInit(compound_head(page)); })
 #define PF_NO_COMPOUND(page, modify) ({				\
 		VM_BUG_ON_PGFLAGS(modify && PageCompound(page), page);	\
-		PF_POISONED_CHECK(page); })
+		CheckPageInit(page); })
 
 /*
  * Macros to create function definitions for page flags
-- 
2.16.3

  parent reply	other threads:[~2018-04-14  4:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-14  4:31 [PATCH 0/8] Various PageFlags cleanups Matthew Wilcox
2018-04-14  4:31 ` [PATCH 1/8] mm: Rename PF argument to modify Matthew Wilcox
2018-04-14  4:31 ` [PATCH 2/8] mm: Rename PF_NO_TAIL to PF_TAIL_READ Matthew Wilcox
2018-04-14  4:31 ` Matthew Wilcox [this message]
2018-04-14  4:31 ` [PATCH 4/8] mm: Improve page flag policy documentation Matthew Wilcox
2018-04-14  4:31 ` [PATCH 5/8] mm: Fix bug in page flags checking Matthew Wilcox
2018-04-14  4:31 ` [PATCH 6/8] mm: Turn page policies into functions Matthew Wilcox
2018-04-16 12:46   ` Kirill A. Shutemov
2018-04-14  4:31 ` [PATCH 7/8] mm: Always check PagePolicyNoCompound Matthew Wilcox
2018-04-16 12:51   ` Kirill A. Shutemov
2018-04-17  1:05   ` [lkp-robot] [mm] 7df45c2b6a: kernel_BUG_at_include/linux/page-flags.h kernel test robot
2018-04-14  4:31 ` [PATCH 8/8] mm: Optimise PagePolicyTailRead Matthew Wilcox
2018-04-16 12:54 ` [PATCH 0/8] Various PageFlags cleanups Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180414043145.3953-4-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=mawilcox@microsoft.com \
    --cc=pasha.tatashin@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox