Skip to contentSkip to conversation

generic PAGE_SIZE infrastructure (v2)

RFC PATCH In review Dave Hansen 5 participants 23 messages Aug 28, 2006 – Aug 30, 2006

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/7 generic PAGE_SIZE infrastructure (v2)

Christoph Lameter suggested that I break this up into a few more patches. This one should at least break out the architectures where some real thinking is involved from the trivial ones that have a simple definition of PAGE_SIZE/SHIFT.

----

All architectures currently explicitly define their page size. In some cases (ppc, parisc, ia64, sparc64, mips) this size is somewhat configurable.

There several reimplementations of ways to make sure that PAGE_SIZE is usable in assembly code, yet still somewhat type safe for use in C code (as a UL type). These are all very similar. There are also a number of macros based off of PAGE_SIZE/SHIFT which are duplicated across architectures.

This patch unifies all of those definitions. It defines PAGE_SIZE in a single header which gets its definitions from Kconfig. The new Kconfig options mirror what used to be done with #ifdefs and arch-specific Kconfig options. The new Kconfig menu eliminates the need for parisc, ia64, and sparc64 to have their own "choice" menus for selecting page size. The help text has been adapted from these three architectures, but is now more generic.

For now, architectures must enable GENERIC_PAGE_SIZE in order to get this new code. This option will be removed by the last patch in the series.

Why am I doing this? The OpenVZ beancounter patch hooks into the alloc_thread_info() path, but only in two architectures. It is silly to patch each and every architecture when they all just do the same thing. This is the first step to have a single place in which to do alloc_thread_info(). Oh, and this series removes about 300 lines of code.

 46 files changed, 178 insertions(+), 514 deletions(-)

---

 threadalloc-dave/include/asm-generic/page.h |   33 ++++++++++++++++++--
 threadalloc-dave/mm/Kconfig                 |   45 ++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 3 deletions(-)
include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +30 -3
diff -puN include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure include/asm-generic/page.h
@@ -1,10 +1,38 @@
 #ifndef _ASM_GENERIC_PAGE_H
 #define _ASM_GENERIC_PAGE_H
 
+#include <linux/compiler.h>
+
 #ifdef __KERNEL__
-#ifndef __ASSEMBLY__
 
-#include <linux/compiler.h>
+#ifdef CONFIG_ARCH_GENERIC_PAGE_SIZE
+#ifdef __ASSEMBLY__
+#define ASM_CONST(x) x
+#else
+#define __ASM_CONST(x) x##UL
+#define ASM_CONST(x) __ASM_CONST(x)
+#endif
+
+#define PAGE_SHIFT      CONFIG_PAGE_SHIFT
+#define PAGE_SIZE       (ASM_CONST(1) << PAGE_SHIFT)
+
+/* align addr on a size boundary - adjust address up/down if needed */
+#define _ALIGN_UP(addr,size)    (((addr)+((size)-1))&(~((size)-1)))
+#define _ALIGN_DOWN(addr,size)  ((addr)&(~((size)-1)))
+
+/* align addr on a size boundary - adjust address up if needed */
+#define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
+
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr)        _ALIGN(addr, PAGE_SIZE)
+
+/*
+ * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
+ * assign PAGE_MASK to a larger type it gets extended the way we want
+ * (i.e. with 1s in the high bits)
+ */
+#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
+#endif /* CONFIG_ARCH_GENERIC_PAGE_SIZE */
 
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
@@ -20,7 +48,6 @@ static __inline__ __attribute_const__ in
 	return order;
 }
 
-#endif	/* __ASSEMBLY__ */
 #endif	/* __KERNEL__ */
 
 #endif	/* _ASM_GENERIC_PAGE_H */
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +45 -0

48 lines not on this page · raw message

_

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

#1 lore raw

RFC PATCH 2/7 ia64 generic PAGE_SIZE

This is the ia64 portion to convert it over to the generic PAGE_SIZE framework.

* Change all references to CONFIG_IA64_PAGE_SIZE_*KB to CONFIG_PAGE_SIZE_* and update the defconfigs.
* remove ia64-specific Kconfig menu
* add ia64 default of 16k pages to mm/Kconfig
* add support for 8k and 16k pages, plus 64k if !ITANIUM

---

 threadalloc-dave/include/asm-ia64/ptrace.h             |    6 +--
 threadalloc-dave/include/asm-ia64/page.h               |   21 ----------
 threadalloc-dave/arch/ia64/Kconfig                     |   34 +----------------
 threadalloc-dave/arch/ia64/configs/bigsur_defconfig    |    8 ++--
 threadalloc-dave/arch/ia64/configs/gensparse_defconfig |    8 ++--
 threadalloc-dave/arch/ia64/configs/sim_defconfig       |    8 ++--
 threadalloc-dave/arch/ia64/configs/sn2_defconfig       |    8 ++--
 threadalloc-dave/arch/ia64/configs/tiger_defconfig     |    8 ++--
 threadalloc-dave/arch/ia64/configs/zx1_defconfig       |    8 ++--
 threadalloc-dave/arch/ia64/defconfig                   |    8 ++--
 threadalloc-dave/mm/Kconfig                            |    4 ++
 11 files changed, 38 insertions(+), 83 deletions(-)
include/asm-ia64/ptrace.h renamed from include/asm-ia64/ptrace.h~ia64 +3 -3
diff -puN include/asm-ia64/ptrace.h~ia64 include/asm-ia64/ptrace.h
@@ -64,11 +64,11 @@
  * Base-2 logarithm of number of pages to allocate per task structure
  * (including register backing store and memory stack):
  */
-#if defined(CONFIG_IA64_PAGE_SIZE_4KB)
+#if defined(CONFIG_PAGE_SIZE_4KB)
 # define KERNEL_STACK_SIZE_ORDER		3
-#elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
+#elif defined(CONFIG_PAGE_SIZE_8KB)
 # define KERNEL_STACK_SIZE_ORDER		2
-#elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
+#elif defined(CONFIG_PAGE_SIZE_16KB)
 # define KERNEL_STACK_SIZE_ORDER		1
 #else
 # define KERNEL_STACK_SIZE_ORDER		0
include/asm-ia64/page.h renamed from include/asm-ia64/page.h~ia64 +1 -20
diff -puN include/asm-ia64/page.h~ia64 include/asm-ia64/page.h
@@ -7,7 +7,7 @@
  *	David Mosberger-Tang <[email protected]>
  */
 
-
+#include <asm-generic/page.h>
 #include <asm/intrinsics.h>
 #include <asm/types.h>
 
@@ -24,25 +24,6 @@
 #define RGN_GATE	5	/* Gate page, Kernel text, etc */
 #define RGN_HPAGE	4	/* For Huge TLB pages */
 
-/*
- * PAGE_SHIFT determines the actual kernel page size.
- */
-#if defined(CONFIG_IA64_PAGE_SIZE_4KB)
-# define PAGE_SHIFT	12
-#elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
-# define PAGE_SHIFT	13
-#elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
-# define PAGE_SHIFT	14
-#elif defined(CONFIG_IA64_PAGE_SIZE_64KB)
-# define PAGE_SHIFT	16
-#else
-# error Unsupported page size!
-#endif
-
-#define PAGE_SIZE		(__IA64_UL_CONST(1) << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE - 1))
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 #define PERCPU_PAGE_SHIFT	16	/* log2() of max. size of per-CPU area */
 #define PERCPU_PAGE_SIZE	(__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
 
arch/ia64/Kconfig renamed from arch/ia64/Kconfig~ia64 +2 -32
diff -puN arch/ia64/Kconfig~ia64 arch/ia64/Kconfig
@@ -149,38 +149,8 @@ config MCKINLEY
 
 endchoice
 
-choice
-	prompt "Kernel page size"
-	default IA64_PAGE_SIZE_16KB
-
-config IA64_PAGE_SIZE_4KB
-	bool "4KB"
-	help
-	  This lets you select the page size of the kernel.  For best IA-64
-	  performance, a page size of 8KB or 16KB is recommended.  For best
-	  IA-32 compatibility, a page size of 4KB should be selected (the vast
-	  majority of IA-32 binaries work perfectly fine with a larger page
-	  size).  For Itanium 2 or newer systems, a page size of 64KB can also
-	  be selected.
-
-	  4KB                For best IA-32 compatibility
-	  8KB                For best IA-64 performance
-	  16KB               For best IA-64 performance
-	  64KB               Requires Itanium 2 or newer processor.
-
-	  If you don't know what to do, choose 16KB.
-
-config IA64_PAGE_SIZE_8KB
-	bool "8KB"
-
-config IA64_PAGE_SIZE_16KB
-	bool "16KB"
-
-config IA64_PAGE_SIZE_64KB
-	depends on !ITANIUM
-	bool "64KB"
-
-endchoice
+config ARCH_GENERIC_PAGE_SIZE
+	def_bool y
 
 choice
 	prompt "Page Table Levels"
arch/ia64/configs/bigsur_defconfig renamed from arch/ia64/configs/bigsur_defconfig~ia64 +4 -4
diff -puN arch/ia64/configs/bigsur_defconfig~ia64 arch/ia64/configs/bigsur_defconfig
@@ -98,10 +98,10 @@ CONFIG_IA64_DIG=y
 # CONFIG_IA64_HP_SIM is not set
 CONFIG_ITANIUM=y
 # CONFIG_MCKINLEY is not set
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-CONFIG_IA64_PAGE_SIZE_16KB=y
-# CONFIG_IA64_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
arch/ia64/configs/gensparse_defconfig renamed from arch/ia64/configs/gensparse_defconfig~ia64 +4 -4
diff -puN arch/ia64/configs/gensparse_defconfig~ia64 arch/ia64/configs/gensparse_defconfig
@@ -99,10 +99,10 @@ CONFIG_IA64_GENERIC=y
 # CONFIG_IA64_HP_SIM is not set
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-CONFIG_IA64_PAGE_SIZE_16KB=y
-# CONFIG_IA64_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
arch/ia64/configs/sim_defconfig renamed from arch/ia64/configs/sim_defconfig~ia64 +4 -4
diff -puN arch/ia64/configs/sim_defconfig~ia64 arch/ia64/configs/sim_defconfig
@@ -99,10 +99,10 @@ CONFIG_DMA_IS_DMA32=y
 CONFIG_IA64_HP_SIM=y
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-# CONFIG_IA64_PAGE_SIZE_16KB is not set
-CONFIG_IA64_PAGE_SIZE_64KB=y
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+# CONFIG_PAGE_SIZE_16KB is not set
+CONFIG_PAGE_SIZE_64KB=y
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
arch/ia64/configs/sn2_defconfig renamed from arch/ia64/configs/sn2_defconfig~ia64 +4 -4
diff -puN arch/ia64/configs/sn2_defconfig~ia64 arch/ia64/configs/sn2_defconfig
@@ -98,10 +98,10 @@ CONFIG_IA64_SGI_SN2=y
 # CONFIG_IA64_HP_SIM is not set
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-CONFIG_IA64_PAGE_SIZE_16KB=y
-# CONFIG_IA64_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
 # CONFIG_PGTABLE_3 is not set
 CONFIG_PGTABLE_4=y
 # CONFIG_HZ_100 is not set
arch/ia64/configs/tiger_defconfig renamed from arch/ia64/configs/tiger_defconfig~ia64 +4 -4
diff -puN arch/ia64/configs/tiger_defconfig~ia64 arch/ia64/configs/tiger_defconfig
@@ -99,10 +99,10 @@ CONFIG_IA64_DIG=y
 # CONFIG_IA64_HP_SIM is not set
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-CONFIG_IA64_PAGE_SIZE_16KB=y
-# CONFIG_IA64_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
arch/ia64/configs/zx1_defconfig renamed from arch/ia64/configs/zx1_defconfig~ia64 +4 -4
diff -puN arch/ia64/configs/zx1_defconfig~ia64 arch/ia64/configs/zx1_defconfig
@@ -97,10 +97,10 @@ CONFIG_IA64_HP_ZX1=y
 # CONFIG_IA64_HP_SIM is not set
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-CONFIG_IA64_PAGE_SIZE_16KB=y
-# CONFIG_IA64_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
arch/ia64/defconfig renamed from arch/ia64/defconfig~ia64 +4 -4
diff -puN arch/ia64/defconfig~ia64 arch/ia64/defconfig
@@ -99,10 +99,10 @@ CONFIG_IA64_GENERIC=y
 # CONFIG_IA64_HP_SIM is not set
 # CONFIG_ITANIUM is not set
 CONFIG_MCKINLEY=y
-# CONFIG_IA64_PAGE_SIZE_4KB is not set
-# CONFIG_IA64_PAGE_SIZE_8KB is not set
-CONFIG_IA64_PAGE_SIZE_16KB=y
-# CONFIG_IA64_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_4KB is not set
+# CONFIG_PAGE_SIZE_8KB is not set
+CONFIG_PAGE_SIZE_16KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
mm/Kconfig renamed from mm/Kconfig~ia64 +4 -0
diff -puN mm/Kconfig~ia64 mm/Kconfig
@@ -6,6 +6,7 @@
 choice
 	prompt "Kernel Page Size"
 	depends on ARCH_GENERIC_PAGE_SIZE
+	default PAGE_SIZE_16KB if IA64
 config PAGE_SIZE_4KB
 	bool "4KB"
 	help
@@ -23,10 +24,13 @@ config PAGE_SIZE_4KB
 	  Otherwise, choose 4KB.
 config PAGE_SIZE_8KB
 	bool "8KB"
+	depends on IA64
 config PAGE_SIZE_16KB
 	bool "16KB"
+	depends on IA64
 config PAGE_SIZE_64KB
 	bool "64KB"
+	depends on (IA64 && !ITANIUM)
 config PAGE_SIZE_512KB
 	bool "512KB"
 config PAGE_SIZE_4MB

_

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

#2 lore raw

Re: [RFC][PATCH 2/7] ia64 generic PAGE_SIZE

arch/ia64/Kconfig config MCKINLEY · line 183

Quoted 5 lines · Dave Hansen
arch/ia64/Kconfig renamed from arch/ia64/Kconfig~ia64 +0 -5
-config IA64_PAGE_SIZE_64KB
-	depends on !ITANIUM
-	bool "64KB"
-
-endchoice

Uhh.. arch specific stuff in mm/Kconfig. Each arch needs to modify the mm/Kconfig?

Also cc [email protected] on these.

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

#3 lore raw

Re: [RFC][PATCH 2/7] ia64 generic PAGE_SIZE

Quoted 9 lines · Christoph Lameter

arch/ia64/Kconfig config MCKINLEY · line 183

Quoted 5 lines · Dave Hansen
arch/ia64/Kconfig renamed from arch/ia64/Kconfig~ia64 +0 -5
-config IA64_PAGE_SIZE_64KB
-     depends on !ITANIUM
-     bool "64KB"
-
-endchoice

Uhh.. arch specific stuff in mm/Kconfig. Each arch needs to modify the mm/Kconfig?

Yes and no. First of all, 15 of the 24 architectures use the Kconfig default of 4k pages. Anybody adding an architecture with 4k pages only has to include asm-generic/page.h in their arch, and they don't add *anything* to Kconfig. If they want completely fixed page sizes other than 4k, they only add '|| ARCH' on one line in the Kconfig.

There are a couple of ways to go about enabling the configurable page sizes. One is to do what I did, hand have all of the architectures enumerated in mm/Kconfig. The other is to have something along the lines of:

choice
prompt "Kernel Page Size"
depends on ARCH_CHOOSES_PAGE_SIZE
...

Then in arch/{ia64,...}/Kconfig, have

config ARCH_CHOOSES_PAGE_SIZE
def_bool y

That would be easy enough to do. However, what I wanted to get out of this was to be able to look at mm/Kconfig and get a really nice overview of what *everybody* is doing. I'd be more inclined to do the ARCH_CHOOSES... stuff if the architecture-specific conditions were actually complicated. They really aren't.

Admittedly, this is a bit different from how it has been done traditionally, but is is a really great tool for anyone working on arch-generic code that wants to know "what architectures have an 8k page size", or "what arches have a configurable page size". This makes one place to go look, with zero grepping.

Quoted 1 line

Also cc [email protected] on these.

Sure thing.

-- Dave

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

#4 lore raw

Re: [RFC][PATCH 2/7] ia64 generic PAGE_SIZE

Quoted 5 lines · Dave Hansen

Yes and no. First of all, 15 of the 24 architectures use the Kconfig default of 4k pages. Anybody adding an architecture with 4k pages only has to include asm-generic/page.h in their arch, and they don't add *anything* to Kconfig. If they want completely fixed page sizes other than 4k, they only add '|| ARCH' on one line in the Kconfig.

Lets keep the arch specific stuff out of mm/Kconfig.

Quoted 10 lines

There are a couple of ways to go about enabling the configurable page sizes. One is to do what I did, hand have all of the architectures enumerated in mm/Kconfig. The other is to have something along the lines of:

choice
prompt "Kernel Page Size"
depends on ARCH_CHOOSES_PAGE_SIZE
...

Quoted 4 lines

Then in arch/{ia64,...}/Kconfig, have

config ARCH_CHOOSES_PAGE_SIZE
def_bool y

How about having definitions like ARCH_SUPPORTS_4/8/16k_PAGESIZE and ARCH_DEFAULT_4/8/16k_PAGESIZE and use those in mm/Kconfig. That way you keep the arch specific stuff out. Each arch just sets up whatever it supports.

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

#5 lore raw

Re: [RFC][PATCH 2/7] ia64 generic PAGE_SIZE

Quoted 1 line · Christoph Lameter

Lets keep the arch specific stuff out of mm/Kconfig.

I know that the normal way of doing things has been with ARCH_SUPPORTS_FOO defined in arch/Kconfig. But, I really like the alternate approach because it is so easy to figure out which architectures support which page sizes with a single glance at the Kconfig file.

I can really see putting another layer of indirection in there if things were too complicated to understand at a glance, but I think they've remained pretty simple.

Is there any specific reason that you dislike the arch-specific stuff in mm/Kconfig?

I don't mind creating those other Kconfig options, but I'm not really sure I see a concrete reason for it, yet.

-- Dave

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

#6 lore raw

RFC PATCH 3/7 sparc64 generic PAGE_SIZE

In reply to Dave Hansen

This is the sparc64 portion to convert it over to the generic PAGE_SIZE framework.

* Change all references to CONFIG_SPARC64_PAGE_SIZE_*KB to CONFIG_PAGE_SIZE_* and update the defconfig.
* remove sparc64-specific Kconfig menu
* add sparc64 default of 8k pages to mm/Kconfig
* remove generic support for 4k pages
* add support for 8k, 64k, 512k, and 4MB pages

---

 threadalloc-dave/include/asm-sparc64/page.h |   19 ----------------
 threadalloc-dave/include/asm-sparc64/mmu.h  |    8 +++----
 threadalloc-dave/arch/sparc64/Kconfig       |   32 +++-------------------------
 threadalloc-dave/arch/sparc64/defconfig     |    8 +++----
 threadalloc-dave/arch/sparc64/mm/tsb.c      |    8 +++----
 threadalloc-dave/mm/Kconfig                 |    8 +++++--
 6 files changed, 23 insertions(+), 60 deletions(-)
include/asm-sparc64/page.h renamed from include/asm-sparc64/page.h~sparc64 +1 -18
diff -puN include/asm-sparc64/page.h~sparc64 include/asm-sparc64/page.h
@@ -4,21 +4,7 @@
 #define _SPARC64_PAGE_H
 
 #include <asm/const.h>
-
-#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
-#define PAGE_SHIFT   13
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB)
-#define PAGE_SHIFT   16
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_512KB)
-#define PAGE_SHIFT   19
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_4MB)
-#define PAGE_SHIFT   22
-#else
-#error No page size specified in kernel configuration
-#endif
-
-#define PAGE_SIZE    (_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK    (~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 /* Flushing for D-cache alias handling is only needed if
  * the page size is smaller than 16K.
@@ -114,9 +100,6 @@ typedef unsigned long pgprot_t;
 
 #endif /* !(__ASSEMBLY__) */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 /* We used to stick this into a hard-coded global register (%g4)
  * but that does not make sense anymore.
  */
include/asm-sparc64/mmu.h renamed from include/asm-sparc64/mmu.h~sparc64 +4 -4
diff -puN include/asm-sparc64/mmu.h~sparc64 include/asm-sparc64/mmu.h
@@ -30,13 +30,13 @@
 #define CTX_PGSZ_MASK		((CTX_PGSZ_BITS << CTX_PGSZ0_SHIFT) | \
 				 (CTX_PGSZ_BITS << CTX_PGSZ1_SHIFT))
 
-#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
+#if defined(CONFIG_PAGE_SIZE_8KB)
 #define CTX_PGSZ_BASE	CTX_PGSZ_8KB
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB)
+#elif defined(CONFIG_PAGE_SIZE_64KB)
 #define CTX_PGSZ_BASE	CTX_PGSZ_64KB
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_512KB)
+#elif defined(CONFIG_PAGE_SIZE_512KB)
 #define CTX_PGSZ_BASE	CTX_PGSZ_512KB
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_4MB)
+#elif defined(CONFIG_PAGE_SIZE_4MB)
 #define CTX_PGSZ_BASE	CTX_PGSZ_4MB
 #else
 #error No page size specified in kernel configuration
arch/sparc64/Kconfig renamed from arch/sparc64/Kconfig~sparc64 +4 -28
diff -puN arch/sparc64/Kconfig~sparc64 arch/sparc64/Kconfig
@@ -34,32 +34,8 @@ config ARCH_MAY_HAVE_PC_FDC
 	bool
 	default y
 
-choice
-	prompt "Kernel page size"
-	default SPARC64_PAGE_SIZE_8KB
-
-config SPARC64_PAGE_SIZE_8KB
-	bool "8KB"
-	help
-	  This lets you select the page size of the kernel.
-
-	  8KB and 64KB work quite well, since Sparc ELF sections
-	  provide for up to 64KB alignment.
-
-	  Therefore, 512KB and 4MB are for expert hackers only.
-
-	  If you don't know what to do, choose 8KB.
-
-config SPARC64_PAGE_SIZE_64KB
-	bool "64KB"
-
-config SPARC64_PAGE_SIZE_512KB
-	bool "512KB"
-
-config SPARC64_PAGE_SIZE_4MB
-	bool "4MB"
-
-endchoice
+config ARCH_GENERIC_PAGE_SIZE
+	def_bool y
 
 config SECCOMP
 	bool "Enable seccomp to safely compute untrusted bytecode"
@@ -187,11 +163,11 @@ config HUGETLB_PAGE_SIZE_4MB
 	bool "4MB"
 
 config HUGETLB_PAGE_SIZE_512K
-	depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB
+	depends on !PAGE_SIZE_4MB && !PAGE_SIZE_512KB
 	bool "512K"
 
 config HUGETLB_PAGE_SIZE_64K
-	depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB && !SPARC64_PAGE_SIZE_64KB
+	depends on !PAGE_SIZE_4MB && !PAGE_SIZE_512KB && !PAGE_SIZE_64KB
 	bool "64K"
 
 endchoice
arch/sparc64/defconfig renamed from arch/sparc64/defconfig~sparc64 +4 -4
diff -puN arch/sparc64/defconfig~sparc64 arch/sparc64/defconfig
@@ -9,10 +9,10 @@ CONFIG_64BIT=y
 CONFIG_MMU=y
 CONFIG_TIME_INTERPOLATION=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
-CONFIG_SPARC64_PAGE_SIZE_8KB=y
-# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
-# CONFIG_SPARC64_PAGE_SIZE_512KB is not set
-# CONFIG_SPARC64_PAGE_SIZE_4MB is not set
+CONFIG_PAGE_SIZE_8KB=y
+# CONFIG_PAGE_SIZE_64KB is not set
+# CONFIG_PAGE_SIZE_512KB is not set
+# CONFIG_PAGE_SIZE_4MB is not set
 CONFIG_SECCOMP=y
 # CONFIG_HZ_100 is not set
 CONFIG_HZ_250=y
arch/sparc64/mm/tsb.c renamed from arch/sparc64/mm/tsb.c~sparc64 +4 -4
diff -puN arch/sparc64/mm/tsb.c~sparc64 arch/sparc64/mm/tsb.c
@@ -90,16 +90,16 @@ void flush_tsb_user(struct mmu_gather *m
 	spin_unlock_irqrestore(&mm->context.lock, flags);
 }
 
-#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
+#if defined(CONFIG_PAGE_SIZE_8KB)
 #define HV_PGSZ_IDX_BASE	HV_PGSZ_IDX_8K
 #define HV_PGSZ_MASK_BASE	HV_PGSZ_MASK_8K
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB)
+#elif defined(CONFIG_PAGE_SIZE_64KB)
 #define HV_PGSZ_IDX_BASE	HV_PGSZ_IDX_64K
 #define HV_PGSZ_MASK_BASE	HV_PGSZ_MASK_64K
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_512KB)
+#elif defined(CONFIG_PAGE_SIZE_512KB)
 #define HV_PGSZ_IDX_BASE	HV_PGSZ_IDX_512K
 #define HV_PGSZ_MASK_BASE	HV_PGSZ_MASK_512K
-#elif defined(CONFIG_SPARC64_PAGE_SIZE_4MB)
+#elif defined(CONFIG_PAGE_SIZE_4MB)
 #define HV_PGSZ_IDX_BASE	HV_PGSZ_IDX_4MB
 #define HV_PGSZ_MASK_BASE	HV_PGSZ_MASK_4MB
 #else
mm/Kconfig renamed from mm/Kconfig~sparc64 +6 -2
diff -puN mm/Kconfig~sparc64 mm/Kconfig
@@ -6,9 +6,11 @@
 choice
 	prompt "Kernel Page Size"
 	depends on ARCH_GENERIC_PAGE_SIZE
+	default PAGE_SIZE_8KB if SPARC64
 	default PAGE_SIZE_16KB if IA64
 config PAGE_SIZE_4KB
 	bool "4KB"
+	depends on !SPARC64
 	help
 	  This lets you select the page size of the kernel.  For best 64-bit
 	  performance, a page size of larger than 4k is recommended.  For best
@@ -24,17 +26,19 @@ config PAGE_SIZE_4KB
 	  Otherwise, choose 4KB.
 config PAGE_SIZE_8KB
 	bool "8KB"
-	depends on IA64
+	depends on IA64 || SPARC64
 config PAGE_SIZE_16KB
 	bool "16KB"
 	depends on IA64
 config PAGE_SIZE_64KB
 	bool "64KB"
-	depends on (IA64 && !ITANIUM)
+	depends on (IA64 && !ITANIUM) || SPARC64
 config PAGE_SIZE_512KB
 	bool "512KB"
+	depends on SPARC64
 config PAGE_SIZE_4MB
 	bool "4MB"
+	depends on SPARC64
 endchoice
 
 config PAGE_SHIFT

_

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

#7 lore raw

RFC PATCH 4/7 mips generic PAGE_SIZE

In reply to Dave Hansen

This is the mips portion to convert it over to the generic PAGE_SIZE framework.

* remove mips-specific Kconfig menu
* add mips default of 4k pages to mm/Kconfig
* replace mips Kconfig menu with plain bool variables to preserve dependencies on specific CPUs. Add to mm/Kconfig

---

 threadalloc-dave/include/asm-mips/page.h |   23 ----------------
 threadalloc-dave/arch/mips/Kconfig       |   43 +++++--------------------------
 threadalloc-dave/mm/Kconfig              |    7 ++---
 3 files changed, 13 insertions(+), 60 deletions(-)
include/asm-mips/page.h renamed from include/asm-mips/page.h~mips +1 -22
diff -puN include/asm-mips/page.h~mips include/asm-mips/page.h
@@ -9,6 +9,7 @@
 #ifndef _ASM_PAGE_H
 #define _ASM_PAGE_H
 
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
@@ -16,25 +17,6 @@
 
 #endif
 
-/*
- * PAGE_SHIFT determines the page size
- */
-#ifdef CONFIG_PAGE_SIZE_4KB
-#define PAGE_SHIFT	12
-#endif
-#ifdef CONFIG_PAGE_SIZE_8KB
-#define PAGE_SHIFT	13
-#endif
-#ifdef CONFIG_PAGE_SIZE_16KB
-#define PAGE_SHIFT	14
-#endif
-#ifdef CONFIG_PAGE_SIZE_64KB
-#define PAGE_SHIFT	16
-#endif
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK       (~((1 << PAGE_SHIFT) - 1))
-
-
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
@@ -130,9 +112,6 @@ typedef struct { unsigned long pgprot; }
 
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 #define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
 
arch/mips/Kconfig renamed from arch/mips/Kconfig~mips +8 -35

55 lines not on this page · raw message

mm/Kconfig renamed from mm/Kconfig~mips +4 -3
diff -puN mm/Kconfig~mips mm/Kconfig
@@ -6,6 +6,7 @@
 choice
 	prompt "Kernel Page Size"
 	depends on ARCH_GENERIC_PAGE_SIZE
+	default PAGE_SIZE_4KB if MIPS
 	default PAGE_SIZE_8KB if SPARC64
 	default PAGE_SIZE_16KB if IA64
 config PAGE_SIZE_4KB
@@ -26,13 +27,13 @@ config PAGE_SIZE_4KB
 	  Otherwise, choose 4KB.
 config PAGE_SIZE_8KB
 	bool "8KB"
-	depends on IA64 || SPARC64
+	depends on IA64 || SPARC64 || MIPS_PAGE_SIZE_8KB
 config PAGE_SIZE_16KB
 	bool "16KB"
-	depends on IA64
+	depends on IA64 || MIPS_PAGE_SIZE_16KB
 config PAGE_SIZE_64KB
 	bool "64KB"
-	depends on (IA64 && !ITANIUM) || SPARC64
+	depends on (IA64 && !ITANIUM) || SPARC64 || MIPS_PAGE_SIZE_64KB
 config PAGE_SIZE_512KB
 	bool "512KB"
 	depends on SPARC64

_

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

#8 lore raw

RFC PATCH 5/7 parisc generic PAGE_SIZE

In reply to Dave Hansen

This is the parisc portion to convert it over to the generic PAGE_SIZE framework.

* remove parisc-specific Kconfig menu
* add parisc default of 4k pages to mm/Kconfig
* replace parisc Kconfig menu with plain bool Kconfig option to cover both 16KB and 64KB pages: PARISC_LARGER_PAGE_SIZES. This preserves the dependencies on PA8X00.

---

 threadalloc-dave/include/asm-parisc/pgtable.h |    8 +++---
 threadalloc-dave/include/asm-parisc/page.h    |   25 ---------------------
 threadalloc-dave/arch/parisc/Kconfig          |   30 +++-----------------------
 threadalloc-dave/arch/parisc/defconfig        |    6 ++---
 threadalloc-dave/arch/parisc/mm/init.c        |    2 -
 threadalloc-dave/mm/Kconfig                   |    7 +++---
 6 files changed, 17 insertions(+), 61 deletions(-)
include/asm-parisc/pgtable.h renamed from include/asm-parisc/pgtable.h~parisc +4 -4
diff -puN include/asm-parisc/pgtable.h~parisc include/asm-parisc/pgtable.h
@@ -66,7 +66,7 @@
 #endif
 #define KERNEL_INITIAL_SIZE	(1 << KERNEL_INITIAL_ORDER)
 
-#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
+#if defined(CONFIG_64BIT) && defined(CONFIG_PAGE_SIZE_4KB)
 #define PT_NLEVELS	3
 #define PGD_ORDER	1 /* Number of pages per pgd */
 #define PMD_ORDER	1 /* Number of pages per pmd */
@@ -514,11 +514,11 @@ static inline void ptep_set_wrprotect(st
 #define _PAGE_SIZE_ENCODING_16M		6
 #define _PAGE_SIZE_ENCODING_64M		7
 
-#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
+#if defined(CONFIG_PAGE_SIZE_4KB)
 # define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K
-#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
+#elif defined(CONFIG_PAGE_SIZE_16KB)
 # define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_16K
-#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
+#elif defined(CONFIG_PAGE_SIZE_64KB)
 # define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_64K
 #endif
 
include/asm-parisc/page.h renamed from include/asm-parisc/page.h~parisc +1 -24
diff -puN include/asm-parisc/page.h~parisc include/asm-parisc/page.h
@@ -1,29 +1,10 @@
 #ifndef _PARISC_PAGE_H
 #define _PARISC_PAGE_H
 
-#if !defined(__KERNEL__)
-/* this is for userspace applications (4k page size) */
-# define PAGE_SHIFT	12	/* 4k */
-# define PAGE_SIZE	(1UL << PAGE_SHIFT)
-# define PAGE_MASK	(~(PAGE_SIZE-1))
-#endif
-
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
-#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
-# define PAGE_SHIFT	12	/* 4k */
-#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
-# define PAGE_SHIFT	14	/* 16k */
-#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
-# define PAGE_SHIFT	16	/* 64k */
-#else
-# error "unknown default kernel page size"
-#endif
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-
-
 #ifndef __ASSEMBLY__
 
 #include <asm/types.h>
@@ -140,10 +121,6 @@ extern int npmem_ranges;
 #define PMD_ENTRY_SIZE	(1UL << BITS_PER_PMD_ENTRY)
 #define PTE_ENTRY_SIZE	(1UL << BITS_PER_PTE_ENTRY)
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
-
 #define LINUX_GATEWAY_SPACE     0
 
 /* This governs the relationship between virtual and physical addresses.
arch/parisc/Kconfig renamed from arch/parisc/Kconfig~parisc +4 -26
diff -puN arch/parisc/Kconfig~parisc arch/parisc/Kconfig
@@ -142,34 +142,12 @@ config 64BIT
 	  enable this option otherwise. The 64bit kernel is significantly bigger
 	  and slower than the 32bit one.
 
-choice
-	prompt "Kernel page size"
-	default PARISC_PAGE_SIZE_4KB  if !64BIT
-	default PARISC_PAGE_SIZE_4KB  if 64BIT
-#	default PARISC_PAGE_SIZE_16KB if 64BIT
-
-config PARISC_PAGE_SIZE_4KB
-	bool "4KB"
-	help
-	  This lets you select the page size of the kernel.  For best
-	  performance, a page size of 16KB is recommended.  For best
-	  compatibility with 32bit applications, a page size of 4KB should be
-	  selected (the vast majority of 32bit binaries work perfectly fine
-	  with a larger page size).
-
-	  4KB                For best 32bit compatibility
-	  16KB               For best performance
-	  64KB               For best performance, might give more overhead.
-
-	  If you don't know what to do, choose 4KB.
-
-config PARISC_PAGE_SIZE_16KB
-	bool "16KB (EXPERIMENTAL)"
+config PARISC_LARGER_PAGE_SIZES
+	def_bool y
 	depends on PA8X00 && EXPERIMENTAL
 
-config PARISC_PAGE_SIZE_64KB
-	bool "64KB (EXPERIMENTAL)"
-	depends on PA8X00 && EXPERIMENTAL
+config ARCH_GENERIC_PAGE_SIZE
+	def_bool y
 
 endchoice
 
arch/parisc/defconfig renamed from arch/parisc/defconfig~parisc +3 -3
diff -puN arch/parisc/defconfig~parisc arch/parisc/defconfig
@@ -91,9 +91,9 @@ CONFIG_PA7100LC=y
 # CONFIG_PA7300LC is not set
 # CONFIG_PA8X00 is not set
 CONFIG_PA11=y
-CONFIG_PARISC_PAGE_SIZE_4KB=y
-# CONFIG_PARISC_PAGE_SIZE_16KB is not set
-# CONFIG_PARISC_PAGE_SIZE_64KB is not set
+CONFIG_PAGE_SIZE_4KB=y
+# CONFIG_PAGE_SIZE_16KB is not set
+# CONFIG_PAGE_SIZE_64KB is not set
 # CONFIG_SMP is not set
 CONFIG_ARCH_FLATMEM_ENABLE=y
 # CONFIG_PREEMPT_NONE is not set
arch/parisc/mm/init.c renamed from arch/parisc/mm/init.c~parisc +1 -1
diff -puN arch/parisc/mm/init.c~parisc arch/parisc/mm/init.c
@@ -642,7 +642,7 @@ static void __init map_pages(unsigned lo
 				 * Map the fault vector writable so we can
 				 * write the HPMC checksum.
 				 */
-#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
+#if defined(CONFIG_PAGE_SIZE_4KB)
 				if (address >= ro_start && address < ro_end
 							&& address != fv_addr
 							&& address != gw_addr)
mm/Kconfig renamed from mm/Kconfig~parisc +4 -3
diff -puN mm/Kconfig~parisc mm/Kconfig
@@ -6,7 +6,7 @@
 choice
 	prompt "Kernel Page Size"
 	depends on ARCH_GENERIC_PAGE_SIZE
-	default PAGE_SIZE_4KB if MIPS
+	default PAGE_SIZE_4KB if MIPS || PARISC
 	default PAGE_SIZE_8KB if SPARC64
 	default PAGE_SIZE_16KB if IA64
 config PAGE_SIZE_4KB
@@ -30,10 +30,11 @@ config PAGE_SIZE_8KB
 	depends on IA64 || SPARC64 || MIPS_PAGE_SIZE_8KB
 config PAGE_SIZE_16KB
 	bool "16KB"
-	depends on IA64 || MIPS_PAGE_SIZE_16KB
+	depends on IA64 || MIPS_PAGE_SIZE_16KB || PARISC_LARGER_PAGE_SIZES
 config PAGE_SIZE_64KB
 	bool "64KB"
-	depends on (IA64 && !ITANIUM) || SPARC64 || MIPS_PAGE_SIZE_64KB
+	depends on (IA64 && !ITANIUM) || SPARC64 || MIPS_PAGE_SIZE_64KB || \
+		   PARISC_LARGER_PAGE_SIZES
 config PAGE_SIZE_512KB
 	bool "512KB"
 	depends on SPARC64

_

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

#9 lore raw

RFC PATCH 6/7 powerpc generic PAGE_SIZE

In reply to Dave Hansen

This is the powerpc portion to convert it over to the generic PAGE_SIZE framework.

* add powerpc default of 64k pages to mm/Kconfig, when the 64k option is enabled. Defaults to 4k otherwise.

---

 threadalloc-dave/include/asm-powerpc/page.h |   34 ++--------------------------
 threadalloc-dave/include/asm-ppc/page.h     |   22 ------------------
 threadalloc-dave/arch/powerpc/Kconfig       |    5 +++-
 threadalloc-dave/arch/powerpc/boot/page.h   |   22 ------------------
 threadalloc-dave/mm/Kconfig                 |    2 -
 5 files changed, 10 insertions(+), 75 deletions(-)
include/asm-powerpc/page.h renamed from include/asm-powerpc/page.h~powerpc +3 -31
diff -puN include/asm-powerpc/page.h~powerpc include/asm-powerpc/page.h
@@ -10,32 +10,14 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#include <asm-generic/page.h>
+
 #ifdef __KERNEL__
 #include <asm/asm-compat.h>
 #include <asm/kdump.h>
 
-/*
- * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
- * page size. When using 64K pages however, whether we are really supporting
- * 64K pages in HW or not is irrelevant to those definitions.
- */
-#ifdef CONFIG_PPC_64K_PAGES
-#define PAGE_SHIFT		16
-#else
-#define PAGE_SHIFT		12
-#endif
-
-#define PAGE_SIZE		(ASM_CONST(1) << PAGE_SHIFT)
-
 /* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
-#define __HAVE_ARCH_GATE_AREA		1
-
-/*
- * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
- * assign PAGE_MASK to a larger type it gets extended the way we want
- * (i.e. with 1s in the high bits)
- */
-#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
+#define __HAVE_ARCH_GATE_AREA          1
 
 /*
  * KERNELBASE is the virtual address of the start of the kernel, it's often
@@ -89,16 +71,6 @@
 #include <asm/page_32.h>
 #endif
 
-/* align addr on a size boundary - adjust address up/down if needed */
-#define _ALIGN_UP(addr,size)	(((addr)+((size)-1))&(~((size)-1)))
-#define _ALIGN_DOWN(addr,size)	((addr)&(~((size)-1)))
-
-/* align addr on a size boundary - adjust address up if needed */
-#define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	_ALIGN(addr, PAGE_SIZE)
-
 /*
  * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
  * "kernelness", use is_kernel_addr() - it should do what you want.
include/asm-ppc/page.h renamed from include/asm-ppc/page.h~powerpc +1 -21
diff -puN include/asm-ppc/page.h~powerpc include/asm-ppc/page.h
@@ -2,16 +2,7 @@
 #define _PPC_PAGE_H
 
 #include <asm/asm-compat.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#define PAGE_SIZE	(ASM_CONST(1) << PAGE_SHIFT)
-
-/*
- * Subtle: this is an int (not an unsigned long) and so it
- * gets extended to 64 bits the way want (i.e. with 1s).  -- paulus
- */
-#define PAGE_MASK	(~((1 << PAGE_SHIFT) - 1))
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
@@ -36,17 +27,6 @@ typedef unsigned long pte_basic_t;
 #define PTE_FMT		"%.8lx"
 #endif
 
-/* align addr on a size boundary - adjust address up/down if needed */
-#define _ALIGN_UP(addr,size)	(((addr)+((size)-1))&(~((size)-1)))
-#define _ALIGN_DOWN(addr,size)	((addr)&(~((size)-1)))
-
-/* align addr on a size boundary - adjust address up if needed */
-#define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	_ALIGN(addr, PAGE_SIZE)
-
-
 #undef STRICT_MM_TYPECHECKS
 
 #ifdef STRICT_MM_TYPECHECKS
arch/powerpc/Kconfig renamed from arch/powerpc/Kconfig~powerpc +4 -1
diff -puN arch/powerpc/Kconfig~powerpc arch/powerpc/Kconfig
@@ -725,8 +725,11 @@ config ARCH_MEMORY_PROBE
 	def_bool y
 	depends on MEMORY_HOTPLUG
 
+config ARCH_GENERIC_PAGE_SIZE
+	def_bool y
+
 config PPC_64K_PAGES
-	bool "64k page size"
+	bool "enable 64k page size"
 	depends on PPC64
 	help
 	  This option changes the kernel logical page size to 64k. On machines
arch/powerpc/boot/page.h renamed from arch/powerpc/boot/page.h~powerpc +1 -21
diff -puN arch/powerpc/boot/page.h~powerpc arch/powerpc/boot/page.h
@@ -9,26 +9,6 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#ifdef __ASSEMBLY__
-#define ASM_CONST(x) x
-#else
-#define __ASM_CONST(x) x##UL
-#define ASM_CONST(x) __ASM_CONST(x)
-#endif
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#define PAGE_SIZE	(ASM_CONST(1) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-
-/* align addr on a size boundary - adjust address up/down if needed */
-#define _ALIGN_UP(addr,size)	(((addr)+((size)-1))&(~((size)-1)))
-#define _ALIGN_DOWN(addr,size)	((addr)&(~((size)-1)))
-
-/* align addr on a size boundary - adjust address up if needed */
-#define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	_ALIGN(addr, PAGE_SIZE)
+#include <asm-generic/page.h>
 
 #endif				/* _PPC_BOOT_PAGE_H */
mm/Kconfig renamed from mm/Kconfig~powerpc +1 -1
diff -puN mm/Kconfig~powerpc mm/Kconfig
@@ -48,7 +48,7 @@ config PAGE_SHIFT
 	depends on ARCH_GENERIC_PAGE_SIZE
 	default "13" if PAGE_SIZE_8KB
 	default "14" if PAGE_SIZE_16KB
-	default "16" if PAGE_SIZE_64KB
+	default "16" if PAGE_SIZE_64KB || PPC_64K_PAGES
 	default "19" if PAGE_SIZE_512KB
 	default "22" if PAGE_SIZE_4MB
 	default "12"

_

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

#10 lore raw

RFC PATCH 7/7 convert the "easy" architectures to generic PAGE_SIZE

In reply to Dave Hansen

This makes all of the rest of the architectures use the generic PAGE_SIZE infrastructure. These should be the easy ones that basically don't allow the user to configure the page size at all.

Note that, as promised, this removes ARCH_GENERIC_PAGE_SIZE introduced by the first patch in this series. It is no longer needed as _all_ architectures now use this infrastructure.

---

 threadalloc-dave/include/asm-generic/page.h   |    4 ++--
 threadalloc-dave/include/asm-alpha/page.h     |    9 +--------
 threadalloc-dave/include/asm-arm/page.h       |    9 +--------
 threadalloc-dave/include/asm-arm26/page.h     |    7 +------
 threadalloc-dave/include/asm-cris/page.h      |   13 +------------
 threadalloc-dave/include/asm-frv/mem-layout.h |   15 ++-------------
 threadalloc-dave/include/asm-frv/page.h       |    4 +---
 threadalloc-dave/include/asm-h8300/page.h     |   11 +----------
 threadalloc-dave/include/asm-i386/page.h      |    8 +-------
 threadalloc-dave/include/asm-m68k/page.h      |   20 +-------------------
 threadalloc-dave/include/asm-m68knommu/page.h |   10 +---------
 threadalloc-dave/include/asm-s390/page.h      |    8 +-------
 threadalloc-dave/include/asm-sh/page.h        |   10 +---------
 threadalloc-dave/include/asm-sh64/page.h      |   12 +-----------
 threadalloc-dave/include/asm-sparc/page.h     |   16 +---------------
 threadalloc-dave/include/asm-um/page.h        |    9 +--------
 threadalloc-dave/include/asm-v850/page.h      |   12 +-----------
 threadalloc-dave/include/asm-x86_64/page.h    |   12 +-----------
 threadalloc-dave/include/asm-xtensa/page.h    |   11 +----------
 threadalloc-dave/arch/ia64/Kconfig            |    3 ---
 threadalloc-dave/arch/mips/Kconfig            |    3 ---
 threadalloc-dave/arch/parisc/Kconfig          |    3 ---
 threadalloc-dave/arch/powerpc/Kconfig         |    3 ---
 threadalloc-dave/arch/sparc64/Kconfig         |    3 ---
 threadalloc-dave/mm/Kconfig                   |   23 +++++++++++++----------
 25 files changed, 34 insertions(+), 204 deletions(-)
include/asm-generic/page.h renamed from include/asm-generic/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +2 -2
diff -puN include/asm-generic/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-generic/page.h
@@ -5,7 +5,6 @@
 
 #ifdef __KERNEL__
 
-#ifdef CONFIG_ARCH_GENERIC_PAGE_SIZE
 #ifdef __ASSEMBLY__
 #define ASM_CONST(x) x
 #else
@@ -32,8 +31,8 @@
  * (i.e. with 1s in the high bits)
  */
 #define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
-#endif /* CONFIG_ARCH_GENERIC_PAGE_SIZE */
 
+#ifndef __ASSEMBLY__
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
 {
@@ -47,6 +46,7 @@ static __inline__ __attribute_const__ in
 	} while (size);
 	return order;
 }
+#endif /* __ASSEMBLY__ */
 
 #endif	/* __KERNEL__ */
 
include/asm-alpha/page.h renamed from include/asm-alpha/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -8
diff -puN include/asm-alpha/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-alpha/page.h
@@ -2,11 +2,7 @@
 #define _ALPHA_PAGE_H
 
 #include <asm/pal.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	13
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
@@ -78,9 +74,6 @@ typedef unsigned long pgprot_t;
 
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
 #ifndef CONFIG_DISCONTIGMEM
include/asm-arm/page.h renamed from include/asm-arm/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -8
diff -puN include/asm-arm/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-arm/page.h
@@ -10,17 +10,10 @@
 #ifndef _ASMARM_PAGE_H
 #define _ASMARM_PAGE_H
 
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT		12
-#define PAGE_SIZE		(1UL << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #ifndef __ASSEMBLY__
 
 #ifndef CONFIG_MMU
include/asm-arm26/page.h renamed from include/asm-arm26/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -6
diff -puN include/asm-arm26/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-arm26/page.h
@@ -1,6 +1,7 @@
 #ifndef _ASMARM_PAGE_H
 #define _ASMARM_PAGE_H
 
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
@@ -79,12 +80,6 @@ typedef unsigned long pgprot_t;
 
 #define EXEC_PAGESIZE   32768
 
-#define PAGE_SIZE		(1UL << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
include/asm-cris/page.h renamed from include/asm-cris/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -12
diff -puN include/asm-cris/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-cris/page.h
@@ -1,17 +1,9 @@
 #ifndef _CRIS_PAGE_H
 #define _CRIS_PAGE_H
 
+#include <asm-generic/page.h>
 #include <asm/arch/page.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	13
-#ifndef __ASSEMBLY__
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE	(1 << PAGE_SHIFT)
-#endif
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-
 #ifdef __KERNEL__
 
 #define clear_page(page)        memset((void *)(page), 0, PAGE_SIZE)
@@ -63,9 +55,6 @@ typedef struct { unsigned long pgprot; }
 
 #define page_to_phys(page)     __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #ifndef __ASSEMBLY__
 
 #endif /* __ASSEMBLY__ */
include/asm-frv/mem-layout.h renamed from include/asm-frv/mem-layout.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +2 -13
diff -puN include/asm-frv/mem-layout.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-frv/mem-layout.h
@@ -12,25 +12,14 @@
 #ifndef _ASM_MEM_LAYOUT_H
 #define _ASM_MEM_LAYOUT_H
 
+#include <asm-generic/page.h>
+
 #ifndef __ASSEMBLY__
 #define __UL(X)	((unsigned long) (X))
 #else
 #define __UL(X)	(X)
 #endif
 
-/*
- * PAGE_SHIFT determines the page size
- */
-#define PAGE_SHIFT			14
-
-#ifndef __ASSEMBLY__
-#define PAGE_SIZE			(1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE			(1 << PAGE_SHIFT)
-#endif
-
-#define PAGE_MASK			(~(PAGE_SIZE-1))
-
 /*****************************************************************************/
 /*
  * virtual memory layout from kernel's point of view
include/asm-frv/page.h renamed from include/asm-frv/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -3
diff -puN include/asm-frv/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-frv/page.h
@@ -3,6 +3,7 @@
 
 #ifdef __KERNEL__
 
+#include <asm-generic/page.h>
 #include <asm/virtconvert.h>
 #include <asm/mem-layout.h>
 #include <asm/sections.h>
@@ -41,9 +42,6 @@ typedef struct { unsigned long	pgprot;	}
 #define __pgprot(x)	((pgprot_t) { (x) } )
 #define PTE_MASK	PAGE_MASK
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
 #define devmem_is_allowed(pfn)	1
 
 #define __pa(vaddr)		virt_to_phys((void *) (unsigned long) (vaddr))
include/asm-h8300/page.h renamed from include/asm-h8300/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -10
diff -puN include/asm-h8300/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-h8300/page.h
@@ -1,16 +1,10 @@
 #ifndef _H8300_PAGE_H
 #define _H8300_PAGE_H
 
-
-/* PAGE_SHIFT determines the page size */
-
-#define PAGE_SHIFT	(12)
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-
 #ifdef __KERNEL__
 
 #include <asm/setup.h>
+#include <asm-generic/page.h>
 
 #ifndef __ASSEMBLY__
  
@@ -44,9 +38,6 @@ typedef struct { unsigned long pgprot; }
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long memory_start;
 extern unsigned long memory_end;
 
include/asm-i386/page.h renamed from include/asm-i386/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -7
diff -puN include/asm-i386/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-i386/page.h
@@ -1,10 +1,7 @@
 #ifndef _I386_PAGE_H
 #define _I386_PAGE_H
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
 #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
@@ -78,9 +75,6 @@ typedef struct { unsigned long pgprot; }
 
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 /*
  * This handles the memory map.. We could make this a config
  * option, but too many people screw it up, and too few need
include/asm-m68k/page.h renamed from include/asm-m68k/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -19
diff -puN include/asm-m68k/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-m68k/page.h
@@ -1,22 +1,7 @@
 #ifndef _M68K_PAGE_H
 #define _M68K_PAGE_H
 
-
-/* PAGE_SHIFT determines the page size */
-#ifndef CONFIG_SUN3
-#define PAGE_SHIFT	(12)
-#else
-#define PAGE_SHIFT	(13)
-#endif
-#ifdef __ASSEMBLY__
-#define PAGE_SIZE	(1 << PAGE_SHIFT)
-#else
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#endif
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-
-#ifdef __KERNEL__
-
+#include <asm-generic/page.h>
 #include <asm/setup.h>
 
 #if PAGE_SHIFT < 13
@@ -103,9 +88,6 @@ typedef struct { unsigned long pgprot; }
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #endif /* !__ASSEMBLY__ */
 
 #include <asm/page_offset.h>
include/asm-m68knommu/page.h renamed from include/asm-m68knommu/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -9
diff -puN include/asm-m68knommu/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-m68knommu/page.h
@@ -1,12 +1,7 @@
 #ifndef _M68KNOMMU_PAGE_H
 #define _M68KNOMMU_PAGE_H
 
-
-/* PAGE_SHIFT determines the page size */
-
-#define PAGE_SHIFT	(12)
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
@@ -44,9 +39,6 @@ typedef struct { unsigned long pgprot; }
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long memory_start;
 extern unsigned long memory_end;
 
include/asm-s390/page.h renamed from include/asm-s390/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -7
diff -puN include/asm-s390/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-s390/page.h
@@ -10,11 +10,8 @@
 #define _S390_PAGE_H
 
 #include <asm/types.h>
+#include <asm-generic/page.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT      12
-#define PAGE_SIZE       (1UL << PAGE_SHIFT)
-#define PAGE_MASK       (~(PAGE_SIZE-1))
 #define PAGE_DEFAULT_ACC	0
 #define PAGE_DEFAULT_KEY	(PAGE_DEFAULT_ACC << 4)
 
@@ -174,9 +171,6 @@ page_get_storage_key(unsigned long addr)
 
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #define __PAGE_OFFSET           0x0UL
 #define PAGE_OFFSET             0x0UL
 #define __pa(x)                 (unsigned long)(x)
include/asm-sh/page.h renamed from include/asm-sh/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -9
diff -puN include/asm-sh/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-sh/page.h
@@ -13,12 +13,7 @@
    [ P4 control   ]		0xE0000000
  */
 
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-#define PTE_MASK	PAGE_MASK
+#include <asm-generic/page.h>
 
 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
 #define HPAGE_SHIFT	16
@@ -79,9 +74,6 @@ typedef struct { unsigned long pgprot; }
 
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 /*
  * IF YOU CHANGE THIS, PLEASE ALSO CHANGE
  *
include/asm-sh64/page.h renamed from include/asm-sh64/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -11
diff -puN include/asm-sh64/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-sh64/page.h
@@ -17,15 +17,8 @@
  *
  */
 
+#include <asm-generic/page.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#ifdef __ASSEMBLY__
-#define PAGE_SIZE	4096
-#else
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#endif
-#define PAGE_MASK	(~(PAGE_SIZE-1))
 #define PTE_MASK	PAGE_MASK
 
 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
@@ -85,9 +78,6 @@ typedef struct { unsigned long pgprot; }
 
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 /*
  * Kconfig defined.
  */
include/asm-sparc/page.h renamed from include/asm-sparc/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -15
diff -puN include/asm-sparc/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-sparc/page.h
@@ -8,18 +8,7 @@
 #ifndef _SPARC_PAGE_H
 #define _SPARC_PAGE_H
 
-#ifdef CONFIG_SUN4
-#define PAGE_SHIFT   13
-#else
-#define PAGE_SHIFT   12
-#endif
-#ifndef __ASSEMBLY__
-/* I have my suspicions... -DaveM */
-#define PAGE_SIZE    (1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE    (1 << PAGE_SHIFT)
-#endif
-#define PAGE_MASK    (~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 
@@ -137,9 +126,6 @@ BTFIXUPDEF_SETHI(sparc_unmapped_base)
 
 #endif /* !(__ASSEMBLY__) */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)  (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 #define PAGE_OFFSET	0xf0000000
 #ifndef __ASSEMBLY__
 extern unsigned long phys_base;
include/asm-um/page.h renamed from include/asm-um/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -8
diff -puN include/asm-um/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-um/page.h
@@ -10,11 +10,7 @@
 struct page;
 
 #include <asm/vm-flags.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <asm-generic/page.h>
 
 /*
  * These are used to make use of C type-checking..
@@ -85,9 +81,6 @@ typedef struct { unsigned long pgprot; }
 #define __pgd(x) ((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 extern unsigned long uml_physmem;
 
 #define PAGE_OFFSET (uml_physmem)
include/asm-v850/page.h renamed from include/asm-v850/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -11
diff -puN include/asm-v850/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-v850/page.h
@@ -15,12 +15,7 @@
 #define __V850_PAGE_H__
 
 #include <asm/machdep.h>
-
-
-#define PAGE_SHIFT	12
-#define PAGE_SIZE       (1UL << PAGE_SHIFT)
-#define PAGE_MASK       (~(PAGE_SIZE-1))
-
+#include <asm-generic/page.h>
 
 /*
  * PAGE_OFFSET -- the first address of the first page of memory. For archs with
@@ -93,11 +88,6 @@ typedef unsigned long pgprot_t;
 
 #endif /* !__ASSEMBLY__ */
 
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
-
-
 /* No current v850 processor has virtual memory.  */
 #define __virt_to_phys(addr)	(addr)
 #define __phys_to_virt(addr)	(addr)
include/asm-x86_64/page.h renamed from include/asm-x86_64/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -11
diff -puN include/asm-x86_64/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-x86_64/page.h
@@ -1,15 +1,8 @@
 #ifndef _X86_64_PAGE_H
 #define _X86_64_PAGE_H
 
+#include <asm-generic/page.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#ifdef __ASSEMBLY__
-#define PAGE_SIZE	(0x1 << PAGE_SHIFT)
-#else
-#define PAGE_SIZE	(1UL << PAGE_SHIFT)
-#endif
-#define PAGE_MASK	(~(PAGE_SIZE-1))
 #define PHYSICAL_PAGE_MASK	(~(PAGE_SIZE-1) & __PHYSICAL_MASK)
 
 #define THREAD_ORDER 1 
@@ -88,9 +81,6 @@ typedef struct { unsigned long pgprot; }
 #define __PAGE_OFFSET           0xffff810000000000
 #endif /* !__ASSEMBLY__ */
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
 /* See Documentation/x86_64/mm.txt for a description of the memory map. */
 #define __PHYSICAL_MASK_SHIFT	46
 #define __PHYSICAL_MASK		((1UL << __PHYSICAL_MASK_SHIFT) - 1)
include/asm-xtensa/page.h renamed from include/asm-xtensa/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -10
diff -puN include/asm-xtensa/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-xtensa/page.h
@@ -14,16 +14,7 @@
 #ifdef __KERNEL__
 
 #include <asm/processor.h>
-
-/*
- * PAGE_SHIFT determines the page size
- * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary
- */
-
-#define PAGE_SHIFT		XCHAL_MMU_MIN_PTE_PAGE_SIZE
-#define PAGE_SIZE		(1 << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE - 1) & PAGE_MASK)
+#include <asm-generic/page.h>
 
 #define DCACHE_WAY_SIZE		(XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS)
 #define PAGE_OFFSET		XCHAL_KSEG_CACHED_VADDR
arch/ia64/Kconfig renamed from arch/ia64/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +0 -3
diff -puN arch/ia64/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT arch/ia64/Kconfig
@@ -149,9 +149,6 @@ config MCKINLEY
 
 endchoice
 
-config ARCH_GENERIC_PAGE_SIZE
-	def_bool y
-
 choice
 	prompt "Page Table Levels"
 	default PGTABLE_3
arch/mips/Kconfig renamed from arch/mips/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +0 -3
diff -puN arch/mips/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT arch/mips/Kconfig
@@ -1444,9 +1444,6 @@ config MIPS_PAGE_SIZE_64KB
 	def_bool y
 	depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
 
-config ARCH_GENERIC_PAGE_SIZE
-	def_bool y
-
 config BOARD_SCACHE
 	bool
 
arch/parisc/Kconfig renamed from arch/parisc/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +0 -3
diff -puN arch/parisc/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT arch/parisc/Kconfig
@@ -146,9 +146,6 @@ config PARISC_LARGER_PAGE_SIZES
 	def_bool y
 	depends on PA8X00 && EXPERIMENTAL
 
-config ARCH_GENERIC_PAGE_SIZE
-	def_bool y
-
 endchoice
 
 config SMP
arch/powerpc/Kconfig renamed from arch/powerpc/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +0 -3
diff -puN arch/powerpc/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT arch/powerpc/Kconfig
@@ -725,9 +725,6 @@ config ARCH_MEMORY_PROBE
 	def_bool y
 	depends on MEMORY_HOTPLUG
 
-config ARCH_GENERIC_PAGE_SIZE
-	def_bool y
-
 config PPC_64K_PAGES
 	bool "enable 64k page size"
 	depends on PPC64
arch/sparc64/Kconfig renamed from arch/sparc64/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +0 -3
diff -puN arch/sparc64/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT arch/sparc64/Kconfig
@@ -34,9 +34,6 @@ config ARCH_MAY_HAVE_PC_FDC
 	bool
 	default y
 
-config ARCH_GENERIC_PAGE_SIZE
-	def_bool y
-
 config SECCOMP
 	bool "Enable seccomp to safely compute untrusted bytecode"
 	depends on PROC_FS
mm/Kconfig renamed from mm/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +13 -10
diff -puN mm/Kconfig~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT mm/Kconfig
@@ -1,11 +1,6 @@
-#
-# On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
-# page size. When using 64K pages however, whether we are really supporting
-# 64K pages in HW or not is irrelevant to those definitions.
-#
 choice
 	prompt "Kernel Page Size"
-	depends on ARCH_GENERIC_PAGE_SIZE
+	depends on MIPS || PARISC || SPARC64 || PARISC
 	default PAGE_SIZE_4KB if MIPS || PARISC
 	default PAGE_SIZE_8KB if SPARC64
 	default PAGE_SIZE_16KB if IA64
@@ -43,15 +38,23 @@ config PAGE_SIZE_4MB
 	depends on SPARC64
 endchoice
 
+#
+# Note that sparc and m68k vary their page sizes based
+# on the SUN3/4 options, so they are not explicitly listed
+#
+# On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
+# page size. When using 64K pages however, whether we are really supporting
+# 64K pages in HW or not is irrelevant to those definitions.
+#
 config PAGE_SHIFT
 	int
-	depends on ARCH_GENERIC_PAGE_SIZE
-	default "13" if PAGE_SIZE_8KB
-	default "14" if PAGE_SIZE_16KB
+	default "13" if PAGE_SIZE_8KB || ALPHA || CRIS || SUN3 || SUN4
+	default "14" if PAGE_SIZE_16KB || FRV
 	default "16" if PAGE_SIZE_64KB || PPC_64K_PAGES
 	default "19" if PAGE_SIZE_512KB
 	default "22" if PAGE_SIZE_4MB
-	default "12"
+	default "12" # arm(26) || h8300 || i386 || m68knommu || m32r || ppc(32)
+		     # s390 || sh/64 || um || v850 || xtensa || x86_64
 
 config SELECT_MEMORY_MODEL
 	def_bool y

_

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

#11 lore raw
Quoted 3 lines · Dave Hansen

diff -puN include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure include/asm-generic/page.h

include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +0 -0

[snip]

include/asm-generic/page.h static __inline__ __attribute_const__ in · line 50

Quoted 10 lines

+ */

include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +2 -0
+#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
+#endif /* CONFIG_ARCH_GENERIC_PAGE_SIZE */
 
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
@@ -20,7 +48,6 @@ static __inline__ __attribute_const__ in
 	return order;
 }
 

You've not handled the case for platforms that have their own get_order().

include/asm-ia64/page.h line 13

Quoted 12 lines · Dave Hansen

diff -puN include/asm-ia64/page.h~ia64 include/asm-ia64/page.h

include/asm-ia64/page.h renamed from include/asm-ia64/page.h~ia64 +1 -1
@@ -7,7 +7,7 @@
  *	David Mosberger-Tang <[email protected]>
  */
 
-
+#include <asm-generic/page.h>
 #include <asm/intrinsics.h>
 #include <asm/types.h>
 

Which will break here..

Quoted 11 lines · Dave Hansen

diff -puN include/asm-ppc/page.h~powerpc include/asm-ppc/page.h

include/asm-ppc/page.h renamed from include/asm-ppc/page.h~powerpc +0 -4
@@ -2,16 +2,7 @@
 #define _PPC_PAGE_H
 
 #include <asm/asm-compat.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#define PAGE_SIZE	(ASM_CONST(1) << PAGE_SHIFT)

include/asm-ppc/page.h line 8

Quoted 10 lines
include/asm-ppc/page.h renamed from include/asm-ppc/page.h~powerpc +1 -6
-
-/*
- * Subtle: this is an int (not an unsigned long) and so it
- * gets extended to 64 bits the way want (i.e. with 1s).  -- paulus
- */
-#define PAGE_MASK	(~((1 << PAGE_SHIFT) - 1))
+#include <asm-generic/page.h>
 
 #ifdef __KERNEL__
 

here..

Quoted 11 lines · Dave Hansen

diff -puN include/asm-xtensa/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT include/asm-xtensa/page.h

include/asm-xtensa/page.h renamed from include/asm-xtensa/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +0 -4
@@ -14,16 +14,7 @@
 #ifdef __KERNEL__
 
 #include <asm/processor.h>
-
-/*
- * PAGE_SHIFT determines the page size
- * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary

include/asm-xtensa/page.h line 20

Quoted 10 lines
include/asm-xtensa/page.h renamed from include/asm-xtensa/page.h~arch-generic-PAGE_SIZE-give-every-arch-PAGE_SHIFT +1 -6
- */
-
-#define PAGE_SHIFT		XCHAL_MMU_MIN_PTE_PAGE_SIZE
-#define PAGE_SIZE		(1 << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE - 1) & PAGE_MASK)
+#include <asm-generic/page.h>
 
 #define DCACHE_WAY_SIZE		(XCHAL_DCACHE_SIZE / XCHAL_DCACHE_WAYS)
 #define PAGE_OFFSET		XCHAL_KSEG_CACHED_VADDR

and here.

You may wish to consider the HAVE_ARCH_GET_ORDER patch I sent to linux-arch, it was intended to handle this.

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

#12 lore raw
Quoted 5 lines · On Tue, 29 Aug 2006 11:46:18 +0900 Paul Mundt wrote:

and here.

You may wish to consider the HAVE_ARCH_GET_ORDER patch I sent to linux-arch, it was intended to handle this.

Is Linus taking that kind of config stuff now? He said it "must DIE," so why take any more of it?

---
~Randy

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

#13 lore raw
Quoted 7 lines · Randy.Dunlap
Quoted 2 lines · On Tue, 29 Aug 2006 11:46:18 +0900 Paul Mundt wrote:

You may wish to consider the HAVE_ARCH_GET_ORDER patch I sent to linux-arch, it was intended to handle this.

Is Linus taking that kind of config stuff now? He said it "must DIE," so why take any more of it?

The alternative is shoving the PAGE_SIZE definitions in a new header, which is even uglier.

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

#14 lore raw
Quoted 10 lines · On Tue, 29 Aug 2006 12:55:29 +0900 Paul Mundt wrote:
Quoted 7 lines · Randy.Dunlap
Quoted 2 lines · On Tue, 29 Aug 2006 11:46:18 +0900 Paul Mundt wrote:

You may wish to consider the HAVE_ARCH_GET_ORDER patch I sent to linux-arch, it was intended to handle this.

Is Linus taking that kind of config stuff now? He said it "must DIE," so why take any more of it?

The alternative is shoving the PAGE_SIZE definitions in a new header, which is even uglier.

That seems to match what he wanted to see (AFAICT), but I agree with you.

---
~Randy

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

#15 lore raw
In reply to Paul Mundt
Quoted 17 lines · Paul Mundt
Quoted 3 lines · Dave Hansen

diff -puN include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure include/asm-generic/page.h

include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +0 -0

[snip]

include/asm-generic/page.h static __inline__ __attribute_const__ in · line 50

Quoted 10 lines

+ */

include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +2 -0
+#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
+#endif /* CONFIG_ARCH_GENERIC_PAGE_SIZE */
 
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
@@ -20,7 +48,6 @@ static __inline__ __attribute_const__ in
 	return order;
 }
 

You've not handled the case for platforms that have their own get_order()

...

Quoted 2 lines

You may wish to consider the HAVE_ARCH_GET_ORDER patch I sent to linux-arch, it was intended to handle this.

Gah. I managed to leave that one off of the end of my series. However, I don't think this is a case where HAVE_ARCH_GET_ORDER is too much of a disease.

Linus requested these:

Quoted 8 lines
Quoted 8 lines
      /*
       * We have a very complex xyzzy, we don't even want to
       * inline it!
       */
      extern void xyxxy(...);

      /* Tell the rest of the world that we do it! */
      #define xyzzy xyzzy

And I find them really hard to follow. But, maybe those were just done badly. Here's the patch that I have for now. I'll go back and try to Linusify it. ;)

I think get_order() is going to have to move out of generic/page.h, though.

-- Dave

include/asm-generic/page.h renamed from include/asm-generic/page.h~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions +2 -0
diff -puN include/asm-generic/page.h~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions include/asm-generic/page.h
@@ -33,6 +33,7 @@
 #define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
 
 #ifndef __ASSEMBLY__
+#ifndef CONFIG_ARCH_HAVE_GET_ORDER
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
 {
@@ -46,6 +47,7 @@ static __inline__ __attribute_const__ in
 	} while (size);
 	return order;
 }
+#endif /* CONFIG_ARCH_HAVE_GET_ORDER */
 #endif /* __ASSEMBLY__ */
 
 #endif	/* __KERNEL__ */
mm/Kconfig renamed from mm/Kconfig~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions +4 -0
diff -puN mm/Kconfig~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions mm/Kconfig
@@ -56,6 +56,10 @@ config PAGE_SHIFT
 	default "12" # arm(26) || h8300 || i386 || m68knommu || m32r || ppc(32)
 		     # s390 || sh/64 || um || v850 || xtensa || x86_64
 
+config ARCH_HAVE_GET_ORDER
+	def_bool y
+	depends on IA64 || PPC || XTENSA
+
 config SELECT_MEMORY_MODEL
 	def_bool y
 	depends on EXPERIMENTAL || ARCH_SELECT_MEMORY_MODEL

_

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

#16 lore raw
Quoted 79 lines · On Tue, 29 Aug 2006 08:29:14 -0700 Dave Hansen wrote:
Quoted 17 lines · Paul Mundt
Quoted 3 lines · Dave Hansen

diff -puN include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure include/asm-generic/page.h

include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +0 -0

[snip]

include/asm-generic/page.h static __inline__ __attribute_const__ in · line 50

Quoted 10 lines

+ */

include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +2 -0
+#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
+#endif /* CONFIG_ARCH_GENERIC_PAGE_SIZE */
 
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
@@ -20,7 +48,6 @@ static __inline__ __attribute_const__ in
 	return order;
 }
 

You've not handled the case for platforms that have their own get_order()

...

Quoted 2 lines

You may wish to consider the HAVE_ARCH_GET_ORDER patch I sent to linux-arch, it was intended to handle this.

Gah. I managed to leave that one off of the end of my series. However, I don't think this is a case where HAVE_ARCH_GET_ORDER is too much of a disease.

Linus requested these:

Quoted 8 lines
Quoted 8 lines
      /*
       * We have a very complex xyzzy, we don't even want to
       * inline it!
       */
      extern void xyxxy(...);

      /* Tell the rest of the world that we do it! */
      #define xyzzy xyzzy

And I find them really hard to follow. But, maybe those were just done badly. Here's the patch that I have for now. I'll go back and try to Linusify it. ;)

I think get_order() is going to have to move out of generic/page.h, though.

-- Dave

diff -puN include/asm-generic/page.h~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions include/asm-generic/page.h

include/asm-generic/page.h renamed from include/asm-generic/page.h~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions +2 -0
@@ -33,6 +33,7 @@
 #define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
 
 #ifndef __ASSEMBLY__
+#ifndef CONFIG_ARCH_HAVE_GET_ORDER
 /* Pure 2^n version of get_order */
 static __inline__ __attribute_const__ int get_order(unsigned long size)
 {
@@ -46,6 +47,7 @@ static __inline__ __attribute_const__ in
 	} while (size);
 	return order;
 }
+#endif /* CONFIG_ARCH_HAVE_GET_ORDER */
 #endif /* __ASSEMBLY__ */
 
 #endif	/* __KERNEL__ */

diff -puN mm/Kconfig~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions mm/Kconfig

mm/Kconfig renamed from mm/Kconfig~Re-_RFC_PATCH_unify_all_architecture_PAGE_SIZE_definitions +4 -0
@@ -56,6 +56,10 @@ config PAGE_SHIFT
 	default "12" # arm(26) || h8300 || i386 || m68knommu || m32r || ppc(32)
 		     # s390 || sh/64 || um || v850 || xtensa || x86_64
 
+config ARCH_HAVE_GET_ORDER
+	def_bool y
+	depends on IA64 || PPC || XTENSA
+
 config SELECT_MEMORY_MODEL
 	def_bool y
 	depends on EXPERIMENTAL || ARCH_SELECT_MEMORY_MODEL
Quoted 1 line

_

fwiw, I believe that the HAVE_ARCH* or ARCH_HAS* thingies are (hidden) config options/flags. But they are not as hidden as burying them in include/linux/*.h files.

I posted 9 (iirc) patches to convert <disease> to Kconfig variables, but hch nacked them. He apparently wants to see Linus's solution. :( I looked into using that and it was too ugly for me.

---
~Randy

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

#17 lore raw
In reply to Dave Hansen

include/asm-generic/page.h line 24

Quoted 6 lines · Dave Hansen
include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +6 -0
+/* align addr on a size boundary - adjust address up/down if needed */
+#define _ALIGN_UP(addr,size)    (((addr)+((size)-1))&(~((size)-1)))
+#define _ALIGN_DOWN(addr,size)  ((addr)&(~((size)-1)))
+
+/* align addr on a size boundary - adjust address up if needed */
+#define _ALIGN(addr,size)     _ALIGN_UP(addr,size)

Note that there is a generic ALIGN macro in include/linux/kernel.h plus __ALIGNs in linux/linkage.h. Could you use that and get to some sane conventin for all these ALIGN functions?

mm/Kconfig line 5

Quoted 5 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +5 -0
+#
+# On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
+# page size. When using 64K pages however, whether we are really supporting
+# 64K pages in HW or not is irrelevant to those definitions.
+#

I guess this is an oversight. This has nothing to do with generic and does not belong into mm/Kconfig

Quoted 8 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +8 -0
+choice
+	prompt "Kernel Page Size"
+	depends on ARCH_GENERIC_PAGE_SIZE
+config PAGE_SIZE_4KB
+	bool "4KB"
+	help
+	  This lets you select the page size of the kernel.  For best 64-bit
+	  performance, a page size of larger than 4k is recommended.  For best

mm/Kconfig line 23

Quoted 10 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +10 -0
+	  32-bit compatibility on 64-bit architectures, a page size of 4KB
+	  should be selected (although most binaries work perfectly fine with
+	  a larger page size).
+
+	  4KB                For best 32-bit compatibility
+	  8KB and up         For best performance
+	  above 64k	     For kernel hackers only
+
+	  If you don't know what to do, choose 8KB (if available).
+	  Otherwise, choose 4KB.

The above also would need to be genericized.

mm/Kconfig line 34

Quoted 11 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +11 -0
+config PAGE_SIZE_8KB
+	bool "8KB"
+config PAGE_SIZE_16KB
+	bool "16KB"
+config PAGE_SIZE_64KB
+	bool "64KB"
+config PAGE_SIZE_512KB
+	bool "512KB"
+config PAGE_SIZE_4MB
+	bool "4MB"
+endchoice

But not all arches support this. Choices need to be restricted to what the arch supports. What about support for other pagesizes in the future. IA64 could f.e. support 128k and 256K pages sizes.

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

#18 lore raw
Quoted 11 lines · Christoph Lameter

include/asm-generic/page.h line 24

Quoted 6 lines · Dave Hansen
include/asm-generic/page.h renamed from include/asm-generic/page.h~generic-PAGE_SIZE-infrastructure +6 -0
+/* align addr on a size boundary - adjust address up/down if needed */
+#define _ALIGN_UP(addr,size)    (((addr)+((size)-1))&(~((size)-1)))
+#define _ALIGN_DOWN(addr,size)  ((addr)&(~((size)-1)))
+
+/* align addr on a size boundary - adjust address up if needed */
+#define _ALIGN(addr,size)     _ALIGN_UP(addr,size)

Note that there is a generic ALIGN macro in include/linux/kernel.h plus __ALIGNs in linux/linkage.h. Could you use that and get to some sane conventin for all these ALIGN functions?

Sure. I'll take a look.

Quoted 8 lines

mm/Kconfig line 5

Quoted 5 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +5 -0
+#
+# On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
+# page size. When using 64K pages however, whether we are really supporting
+# 64K pages in HW or not is irrelevant to those definitions.
+#

I guess this is an oversight. This has nothing to do with generic and does not belong into mm/Kconfig

Yeah, this is gunk. I'll put it back where it belongs.

Quoted 12 lines
Quoted 12 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +12 -0
+choice
+	prompt "Kernel Page Size"
+	depends on ARCH_GENERIC_PAGE_SIZE
+config PAGE_SIZE_4KB
+	bool "4KB"
+	help
+	  This lets you select the page size of the kernel.  For best 64-bit
+	  performance, a page size of larger than 4k is recommended.  For best
+	  32-bit compatibility on 64-bit architectures, a page size of 4KB
+	  should be selected (although most binaries work perfectly fine with
+	  a larger page size).
+
Quoted 8 lines

mm/Kconfig line 23

Quoted 6 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +6 -0
+	  4KB                For best 32-bit compatibility
+	  8KB and up         For best performance
+	  above 64k	     For kernel hackers only
+
+	  If you don't know what to do, choose 8KB (if available).
+	  Otherwise, choose 4KB.

The above also would need to be genericized.

That is genericized. ;) Are there some bits that don't fit ia64 well?

Quoted 7 lines
Quoted 7 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +7 -0
+config PAGE_SIZE_8KB
+	bool "8KB"
+config PAGE_SIZE_16KB
+	bool "16KB"
+config PAGE_SIZE_64KB
+	bool "64KB"
+config PAGE_SIZE_512KB
Quoted 8 lines

mm/Kconfig line 34

Quoted 4 lines
mm/Kconfig renamed from mm/Kconfig~generic-PAGE_SIZE-infrastructure +4 -0
+	bool "512KB"
+config PAGE_SIZE_4MB
+	bool "4MB"
+endchoice

But not all arches support this. Choices need to be restricted to what the arch supports. What about support for other pagesizes in the future. IA64 could f.e. support 128k and 256K pages sizes.

Take a look a few patches further down in the series. Let me know if this isn't resolved.

-- Dave

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

#19 lore raw
Quoted 14 lines
Quoted 14 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

"Dave" == Dave Hansen <[email protected]> writes:

+choice > + prompt "Kernel Page Size" > + depends on

ARCH_GENERIC_PAGE_SIZE > +config PAGE_SIZE_4KB > + bool "4KB" > + help > + This lets you select the page size of the kernel. For best 64-bit > + performance, a page size of larger than 4k is recommended. For best > + 32-bit compatibility on 64-bit architectures, a page size of 4KB > + should be selected (although most binaries work perfectly fine with > + a larger page size). >
+ > + 4KB For best 32-bit compatibility > + 8KB and up For best performance > + above 64k For kernel hackers only > + > + If you don't know what to do, choose 8KB (if available). > + Otherwise, choose 4KB.

Quoted 1 line
Quoted 1 line

The above also would need to be genericized.

Dave> That is genericized. ;) Are there some bits that don't fit ia64 Dave> well?

IA64 wants 16k standard, 64k for better performance. So something that says `choose 8k if you can' doesn't really fit. And it'd be *really* nice to test larger pages --- I see ~5% improvement in streaming I/O to a suitable RAID array with 64k as opposed to 16k pages.

(The full range of hardware-supported page sizes for Itanium 2 is:
4K, 8K, 16K, 64K, 256K, 1M, 4M, 16M, 64M, 256M, 1G, 4G and for Itanium 1 is:
4k, 16k, 64k, 256k, 1M, 4M, 16M, 64M, 256M)

--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au ERTOS within National ICT Australia

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

#20 lore raw
Quoted 5 lines · Peter Chubb

IA64 wants 16k standard, 64k for better performance. So something that says `choose 8k if you can' doesn't really fit. And it'd be *really* nice to test larger pages --- I see ~5% improvement in streaming I/O to a suitable RAID array with 64k as opposed to 16k pages.

I've updated the help text a bit. I'd appreciate if you could take a look at the latest series, which I'll post shortly.

-- Dave

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

#21 lore raw
In reply to Christoph Lameter
Quoted 3 lines · Christoph Lameter

Note that there is a generic ALIGN macro in include/linux/kernel.h plus __ALIGNs in linux/linkage.h. Could you use that and get to some sane conventin for all these ALIGN functions?

The one in kernel.h should certainly be consolidated. What would you think about a linux/macros.h that had things like ARRAY_SIZE and the ALIGN macros, but didn't have any outside dependencies? How about a linux/align.h just for the alignment macros?

-- Dave

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

#22 lore raw
Quoted 9 lines · Dave Hansen
Quoted 3 lines · Christoph Lameter

Note that there is a generic ALIGN macro in include/linux/kernel.h plus __ALIGNs in linux/linkage.h. Could you use that and get to some sane conventin for all these ALIGN functions?

The one in kernel.h should certainly be consolidated. What would you think about a linux/macros.h that had things like ARRAY_SIZE and the ALIGN macros, but didn't have any outside dependencies? How about a linux/align.h just for the alignment macros?

linux/align.h sounds best. macros.h would lead to the accumulation of random macros.

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