aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2015-10-22 09:03:32 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2015-10-22 09:03:32 +1100
commit2c35dfce5c604b9123c7c15ce2fbd3a237e5ae4a (patch)
tree7d9ba4b6e276e42df7e7056c8ae87677cd6335cf /include
parent33dffbbd331e2505178568843ae2ad09e3b306e4 (diff)
page-flags: hide PF_* validation check under separate config option
VM_BUG_ONs in PF_NO_TAIL() and PF_NO_COMPOUND() add 4+ KiB to mm/build-in.o for DEBUG_VM kernel. Let's hide them under new config option -- CONFIG_DEBUG_VM_PGFLAGS. With the option enabled VM_BUG_ON_PGFLAGS() is equal to VM_BUG_ON_PAGE. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Christoph Lameter <cl@linux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mmdebug.h6
-rw-r--r--include/linux/page-flags.h6
2 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 877ef226f90f..c447d8055e50 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -55,4 +55,10 @@ void dump_mm(const struct mm_struct *mm);
#define VIRTUAL_BUG_ON(cond) do { } while (0)
#endif
+#ifdef CONFIG_DEBUG_VM_PGFLAGS
+#define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page)
+#else
+#define VM_BUG_ON_PGFLAGS(cond, page) BUILD_BUG_ON_INVALID(cond)
+#endif
+
#endif
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 625d24c2f3de..12ab023b67f2 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -174,12 +174,10 @@ static inline int PageCompound(struct page *page)
#define PF_ANY(page, enforce) page
#define PF_HEAD(page, enforce) compound_head(page)
#define PF_NO_TAIL(page, enforce) ({ \
- if (enforce) \
- VM_BUG_ON_PAGE(PageTail(page), page); \
+ VM_BUG_ON_PGFLAGS(enforce && PageTail(page), page); \
compound_head(page);})
#define PF_NO_COMPOUND(page, enforce) ({ \
- if (enforce) \
- VM_BUG_ON_PAGE(PageCompound(page), page); \
+ VM_BUG_ON_PGFLAGS(enforce && PageCompound(page), page); \
page;})
/*