aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc64/mm/init.c16
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mmzone.h19
-rw-r--r--include/linux/page-flags.h19
-rw-r--r--kernel/bounds.c2
5 files changed, 31 insertions, 31 deletions
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 177d8aaeec42..8c2b50e8abc6 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -1699,9 +1699,21 @@ void __init paging_init(void)
1699 * functions like clear_dcache_dirty_cpu use the cpu mask 1699 * functions like clear_dcache_dirty_cpu use the cpu mask
1700 * in 13-bit signed-immediate instruction fields. 1700 * in 13-bit signed-immediate instruction fields.
1701 */ 1701 */
1702 BUILD_BUG_ON(FLAGS_RESERVED != 32); 1702
1703 /*
1704 * Page flags must not reach into upper 32 bits that are used
1705 * for the cpu number
1706 */
1707 BUILD_BUG_ON(NR_PAGEFLAGS > 32);
1708
1709 /*
1710 * The bit fields placed in the high range must not reach below
1711 * the 32 bit boundary. Otherwise we cannot place the cpu field
1712 * at the 32 bit boundary.
1713 */
1703 BUILD_BUG_ON(SECTIONS_WIDTH + NODES_WIDTH + ZONES_WIDTH + 1714 BUILD_BUG_ON(SECTIONS_WIDTH + NODES_WIDTH + ZONES_WIDTH +
1704 ilog2(roundup_pow_of_two(NR_CPUS)) > FLAGS_RESERVED); 1715 ilog2(roundup_pow_of_two(NR_CPUS)) > 32);
1716
1705 BUILD_BUG_ON(NR_CPUS > 4096); 1717 BUILD_BUG_ON(NR_CPUS > 4096);
1706 1718
1707 kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL; 1719 kern_base = (prom_boot_mapping_phys_low >> 22UL) << 22UL;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 4f3c1b2f44de..526f810367d9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -407,7 +407,7 @@ static inline void set_compound_order(struct page *page, unsigned long order)
407 407
408#define ZONES_WIDTH ZONES_SHIFT 408#define ZONES_WIDTH ZONES_SHIFT
409 409
410#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED 410#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
411#define NODES_WIDTH NODES_SHIFT 411#define NODES_WIDTH NODES_SHIFT
412#else 412#else
413#ifdef CONFIG_SPARSEMEM_VMEMMAP 413#ifdef CONFIG_SPARSEMEM_VMEMMAP
@@ -455,8 +455,8 @@ static inline void set_compound_order(struct page *page, unsigned long order)
455 455
456#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0)) 456#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
457 457
458#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 458#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
459#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 459#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
460#endif 460#endif
461 461
462#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 462#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 0aece6d8937e..c7a51dac441d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -820,25 +820,6 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
820#include <asm/sparsemem.h> 820#include <asm/sparsemem.h>
821#endif 821#endif
822 822
823#if BITS_PER_LONG == 32
824/*
825 * with 32 bit page->flags field, we reserve 9 bits for node/zone info.
826 * there are 4 zones (3 bits) and this leaves 9-3=6 bits for nodes.
827 */
828#define FLAGS_RESERVED 9
829
830#elif BITS_PER_LONG == 64
831/*
832 * with 64 bit flags field, there's plenty of room.
833 */
834#define FLAGS_RESERVED 32
835
836#else
837
838#error BITS_PER_LONG not defined
839
840#endif
841
842#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 823#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
843 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 824 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
844static inline unsigned long early_pfn_to_nid(unsigned long pfn) 825static inline unsigned long early_pfn_to_nid(unsigned long pfn)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d66971530caa..00e55e23b777 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -6,7 +6,10 @@
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#ifndef __GENERATING_BOUNDS_H
9#include <linux/mm_types.h> 10#include <linux/mm_types.h>
11#include <linux/bounds.h>
12#endif /* !__GENERATING_BOUNDS_H */
10 13
11/* 14/*
12 * Various page->flags bits: 15 * Various page->flags bits:
@@ -59,13 +62,12 @@
59 * extends from the high bits downwards. 62 * extends from the high bits downwards.
60 * 63 *
61 * | FIELD | ... | FLAGS | 64 * | FIELD | ... | FLAGS |
62 * N-1 ^ 0 65 * N-1 ^ 0
63 * (N-FLAGS_RESERVED) 66 * (NR_PAGEFLAGS)
64 * 67 *
65 * The fields area is reserved for fields mapping zone, node and SPARSEMEM 68 * The fields area is reserved for fields mapping zone, node (for NUMA) and
66 * section. The boundry between these two areas is defined by 69 * SPARSEMEM section (for variants of SPARSEMEM that require section ids like
67 * FLAGS_RESERVED which defines the width of the fields section 70 * SPARSEMEM_EXTREME with !SPARSEMEM_VMEMMAP).
68 * (see linux/mmzone.h). New flags must _not_ overlap with this area.
69 */ 71 */
70enum pageflags { 72enum pageflags {
71 PG_locked, /* Page is locked. Don't touch. */ 73 PG_locked, /* Page is locked. Don't touch. */
@@ -101,9 +103,11 @@ enum pageflags {
101 */ 103 */
102 PG_uncached = 31, /* Page has been mapped as uncached */ 104 PG_uncached = 31, /* Page has been mapped as uncached */
103#endif 105#endif
104 NR_PAGEFLAGS 106 __NR_PAGEFLAGS
105}; 107};
106 108
109#ifndef __GENERATING_BOUNDS_H
110
107/* 111/*
108 * Manipulation of page state flags 112 * Manipulation of page state flags
109 */ 113 */
@@ -304,4 +308,5 @@ static inline void set_page_writeback(struct page *page)
304 test_set_page_writeback(page); 308 test_set_page_writeback(page);
305} 309}
306 310
311#endif /* !__GENERATING_BOUNDS_H */
307#endif /* PAGE_FLAGS_H */ 312#endif /* PAGE_FLAGS_H */
diff --git a/kernel/bounds.c b/kernel/bounds.c
index 85bb281858cb..9ca2bb30243c 100644
--- a/kernel/bounds.c
+++ b/kernel/bounds.c
@@ -6,6 +6,7 @@
6 6
7#define __GENERATING_BOUNDS_H 7#define __GENERATING_BOUNDS_H
8/* Include headers that define the enum constants of interest */ 8/* Include headers that define the enum constants of interest */
9#include <linux/page-flags.h>
9 10
10#define DEFINE(sym, val) \ 11#define DEFINE(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 12 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -15,5 +16,6 @@
15void foo(void) 16void foo(void)
16{ 17{
17 /* The enum constants to put into include/linux/bounds.h */ 18 /* The enum constants to put into include/linux/bounds.h */
19 DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
18 /* End of constants */ 20 /* End of constants */
19} 21}