aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrea Righi <righi.andrea@gmail.com>2008-07-24 00:28:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:21 -0400
commit27ac792ca0b0a1e7e65f20342260650516c95864 (patch)
tree8e0bc93612da0803fe12303ccb75c837cd633c83 /include
parentd92bc318547507a944a22e7ef936793dc0fe167f (diff)
PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures
On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit boundary. For example: u64 val = PAGE_ALIGN(size); always returns a value < 4GB even if size is greater than 4GB. The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for example): #define PAGE_SHIFT 12 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) ... #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) The "~" is performed on a 32-bit value, so everything in "and" with PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary. Using the ALIGN() macro seems to be the right way, because it uses typeof(addr) for the mask. Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in include/linux/mm.h. See also lkml discussion: http://lkml.org/lkml/2008/6/11/237 [akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c] [akpm@linux-foundation.org: fix v850] [akpm@linux-foundation.org: fix powerpc] [akpm@linux-foundation.org: fix arm] [akpm@linux-foundation.org: fix mips] [akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c] [akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c] [akpm@linux-foundation.org: fix powerpc] Signed-off-by: Andrea Righi <righi.andrea@gmail.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/page.h3
-rw-r--r--include/asm-arm/page-nommu.h4
-rw-r--r--include/asm-arm/page.h3
-rw-r--r--include/asm-avr32/page.h3
-rw-r--r--include/asm-blackfin/page.h3
-rw-r--r--include/asm-cris/page.h3
-rw-r--r--include/asm-frv/page.h3
-rw-r--r--include/asm-h8300/page.h3
-rw-r--r--include/asm-ia64/page.h1
-rw-r--r--include/asm-m32r/page.h3
-rw-r--r--include/asm-m68k/dvma.h2
-rw-r--r--include/asm-m68k/page.h3
-rw-r--r--include/asm-m68knommu/page.h3
-rw-r--r--include/asm-mips/page.h3
-rw-r--r--include/asm-mips/processor.h2
-rw-r--r--include/asm-mn10300/page.h3
-rw-r--r--include/asm-parisc/page.h4
-rw-r--r--include/asm-powerpc/page.h3
-rw-r--r--include/asm-s390/page.h3
-rw-r--r--include/asm-sh/page.h3
-rw-r--r--include/asm-sparc/page_32.h3
-rw-r--r--include/asm-sparc/page_64.h3
-rw-r--r--include/asm-um/page.h3
-rw-r--r--include/asm-v850/page.h4
-rw-r--r--include/asm-x86/page.h3
-rw-r--r--include/asm-xtensa/page.h2
-rw-r--r--include/linux/mm.h3
27 files changed, 6 insertions, 73 deletions
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index 22ff9762d17b..0995f9d13417 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -80,9 +80,6 @@ typedef struct page *pgtable_t;
80 80
81#endif /* !__ASSEMBLY__ */ 81#endif /* !__ASSEMBLY__ */
82 82
83/* to align the pointer to the (next) page boundary */
84#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
85
86#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 83#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
87#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 84#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
88#ifndef CONFIG_DISCONTIGMEM 85#ifndef CONFIG_DISCONTIGMEM
diff --git a/include/asm-arm/page-nommu.h b/include/asm-arm/page-nommu.h
index a1bcad060480..ea1cde84f500 100644
--- a/include/asm-arm/page-nommu.h
+++ b/include/asm-arm/page-nommu.h
@@ -7,6 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
10#ifndef _ASMARM_PAGE_NOMMU_H 11#ifndef _ASMARM_PAGE_NOMMU_H
11#define _ASMARM_PAGE_NOMMU_H 12#define _ASMARM_PAGE_NOMMU_H
12 13
@@ -42,9 +43,6 @@ typedef unsigned long pgprot_t;
42#define __pmd(x) (x) 43#define __pmd(x) (x)
43#define __pgprot(x) (x) 44#define __pgprot(x) (x)
44 45
45/* to align the pointer to the (next) page boundary */
46#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
47
48extern unsigned long memory_start; 46extern unsigned long memory_start;
49extern unsigned long memory_end; 47extern unsigned long memory_end;
50 48
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 8e05bdb5f12f..7c5fc5582e5d 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -15,9 +15,6 @@
15#define PAGE_SIZE (1UL << PAGE_SHIFT) 15#define PAGE_SIZE (1UL << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1)) 16#define PAGE_MASK (~(PAGE_SIZE-1))
17 17
18/* to align the pointer to the (next) page boundary */
19#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
20
21#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
22 19
23#ifndef CONFIG_MMU 20#ifndef CONFIG_MMU
diff --git a/include/asm-avr32/page.h b/include/asm-avr32/page.h
index cbbc5ca9728b..f805d1cb11bc 100644
--- a/include/asm-avr32/page.h
+++ b/include/asm-avr32/page.h
@@ -57,9 +57,6 @@ static inline int get_order(unsigned long size)
57 57
58#endif /* !__ASSEMBLY__ */ 58#endif /* !__ASSEMBLY__ */
59 59
60/* Align the pointer to the (next) page boundary */
61#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
62
63/* 60/*
64 * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff 61 * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
65 * permanently to the physical addresses 0x00000000 -> 0x1fffffff when 62 * permanently to the physical addresses 0x00000000 -> 0x1fffffff when
diff --git a/include/asm-blackfin/page.h b/include/asm-blackfin/page.h
index c7db0220fbd6..344f6a8c1f22 100644
--- a/include/asm-blackfin/page.h
+++ b/include/asm-blackfin/page.h
@@ -51,9 +51,6 @@ typedef struct page *pgtable_t;
51#define __pgd(x) ((pgd_t) { (x) } ) 51#define __pgd(x) ((pgd_t) { (x) } )
52#define __pgprot(x) ((pgprot_t) { (x) } ) 52#define __pgprot(x) ((pgprot_t) { (x) } )
53 53
54/* to align the pointer to the (next) page boundary */
55#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
56
57extern unsigned long memory_start; 54extern unsigned long memory_start;
58extern unsigned long memory_end; 55extern unsigned long memory_end;
59 56
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index c45bb1ef397c..d19272ba6b69 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -60,9 +60,6 @@ typedef struct page *pgtable_t;
60 60
61#define page_to_phys(page) __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) 61#define page_to_phys(page) __pa((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
62 62
63/* to align the pointer to the (next) page boundary */
64#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
65
66#ifndef __ASSEMBLY__ 63#ifndef __ASSEMBLY__
67 64
68#endif /* __ASSEMBLY__ */ 65#endif /* __ASSEMBLY__ */
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index c2c1e89e747d..bd9c220094c7 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -40,9 +40,6 @@ typedef struct page *pgtable_t;
40#define __pgprot(x) ((pgprot_t) { (x) } ) 40#define __pgprot(x) ((pgprot_t) { (x) } )
41#define PTE_MASK PAGE_MASK 41#define PTE_MASK PAGE_MASK
42 42
43/* to align the pointer to the (next) page boundary */
44#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
45
46#define devmem_is_allowed(pfn) 1 43#define devmem_is_allowed(pfn) 1
47 44
48#define __pa(vaddr) virt_to_phys((void *) (unsigned long) (vaddr)) 45#define __pa(vaddr) virt_to_phys((void *) (unsigned long) (vaddr))
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index d6a3eaf3b27e..0b6acf0b03aa 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -43,9 +43,6 @@ typedef struct page *pgtable_t;
43#define __pgd(x) ((pgd_t) { (x) } ) 43#define __pgd(x) ((pgd_t) { (x) } )
44#define __pgprot(x) ((pgprot_t) { (x) } ) 44#define __pgprot(x) ((pgprot_t) { (x) } )
45 45
46/* to align the pointer to the (next) page boundary */
47#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
48
49extern unsigned long memory_start; 46extern unsigned long memory_start;
50extern unsigned long memory_end; 47extern unsigned long memory_end;
51 48
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 36f39321b768..5f271bc712ee 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -40,7 +40,6 @@
40 40
41#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT) 41#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)
42#define PAGE_MASK (~(PAGE_SIZE - 1)) 42#define PAGE_MASK (~(PAGE_SIZE - 1))
43#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
44 43
45#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */ 44#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */
46#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT) 45#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 8a677f3fca68..c9333089fe11 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -41,9 +41,6 @@ typedef struct page *pgtable_t;
41 41
42#endif /* !__ASSEMBLY__ */ 42#endif /* !__ASSEMBLY__ */
43 43
44/* to align the pointer to the (next) page boundary */
45#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
46
47/* 44/*
48 * This handles the memory map.. We could make this a config 45 * This handles the memory map.. We could make this a config
49 * option, but too many people screw it up, and too few need 46 * option, but too many people screw it up, and too few need
diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h
index 4fff408d0150..890bbf7e7758 100644
--- a/include/asm-m68k/dvma.h
+++ b/include/asm-m68k/dvma.h
@@ -13,7 +13,7 @@
13#define DVMA_PAGE_SHIFT 13 13#define DVMA_PAGE_SHIFT 13
14#define DVMA_PAGE_SIZE (1UL << DVMA_PAGE_SHIFT) 14#define DVMA_PAGE_SIZE (1UL << DVMA_PAGE_SHIFT)
15#define DVMA_PAGE_MASK (~(DVMA_PAGE_SIZE-1)) 15#define DVMA_PAGE_MASK (~(DVMA_PAGE_SIZE-1))
16#define DVMA_PAGE_ALIGN(addr) (((addr)+DVMA_PAGE_SIZE-1)&DVMA_PAGE_MASK) 16#define DVMA_PAGE_ALIGN(addr) ALIGN(addr, DVMA_PAGE_SIZE)
17 17
18extern void dvma_init(void); 18extern void dvma_init(void);
19extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr, 19extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 880c2cbff8a6..a34b8bad7847 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -103,9 +103,6 @@ typedef struct page *pgtable_t;
103#define __pgd(x) ((pgd_t) { (x) } ) 103#define __pgd(x) ((pgd_t) { (x) } )
104#define __pgprot(x) ((pgprot_t) { (x) } ) 104#define __pgprot(x) ((pgprot_t) { (x) } )
105 105
106/* to align the pointer to the (next) page boundary */
107#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
108
109#endif /* !__ASSEMBLY__ */ 106#endif /* !__ASSEMBLY__ */
110 107
111#include <asm/page_offset.h> 108#include <asm/page_offset.h>
diff --git a/include/asm-m68knommu/page.h b/include/asm-m68knommu/page.h
index 1e82ebb7d644..3a1ede4544cb 100644
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -43,9 +43,6 @@ typedef struct page *pgtable_t;
43#define __pgd(x) ((pgd_t) { (x) } ) 43#define __pgd(x) ((pgd_t) { (x) } )
44#define __pgprot(x) ((pgprot_t) { (x) } ) 44#define __pgprot(x) ((pgprot_t) { (x) } )
45 45
46/* to align the pointer to the (next) page boundary */
47#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
48
49extern unsigned long memory_start; 46extern unsigned long memory_start;
50extern unsigned long memory_end; 47extern unsigned long memory_end;
51 48
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 494f00ba9541..fe7a88ea066e 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -137,9 +137,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
137 137
138#endif /* !__ASSEMBLY__ */ 138#endif /* !__ASSEMBLY__ */
139 139
140/* to align the pointer to the (next) page boundary */
141#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
142
143/* 140/*
144 * __pa()/__va() should be used only during mem init. 141 * __pa()/__va() should be used only during mem init.
145 */ 142 */
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 58cbac5a64e4..a1e4453469f9 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -45,7 +45,7 @@ extern unsigned int vced_count, vcei_count;
45 * This decides where the kernel will search for a free chunk of vm 45 * This decides where the kernel will search for a free chunk of vm
46 * space during mmap's. 46 * space during mmap's.
47 */ 47 */
48#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) 48#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
49#endif 49#endif
50 50
51#ifdef CONFIG_64BIT 51#ifdef CONFIG_64BIT
diff --git a/include/asm-mn10300/page.h b/include/asm-mn10300/page.h
index 124971b9fb9b..8288e124165b 100644
--- a/include/asm-mn10300/page.h
+++ b/include/asm-mn10300/page.h
@@ -61,9 +61,6 @@ typedef struct page *pgtable_t;
61 61
62#endif /* !__ASSEMBLY__ */ 62#endif /* !__ASSEMBLY__ */
63 63
64/* to align the pointer to the (next) page boundary */
65#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
66
67/* 64/*
68 * This handles the memory map.. We could make this a config 65 * This handles the memory map.. We could make this a config
69 * option, but too many people screw it up, and too few need 66 * option, but too many people screw it up, and too few need
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 27d50b859541..c3941f09a878 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -119,10 +119,6 @@ extern int npmem_ranges;
119#define PMD_ENTRY_SIZE (1UL << BITS_PER_PMD_ENTRY) 119#define PMD_ENTRY_SIZE (1UL << BITS_PER_PMD_ENTRY)
120#define PTE_ENTRY_SIZE (1UL << BITS_PER_PTE_ENTRY) 120#define PTE_ENTRY_SIZE (1UL << BITS_PER_PTE_ENTRY)
121 121
122/* to align the pointer to the (next) page boundary */
123#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
124
125
126#define LINUX_GATEWAY_SPACE 0 122#define LINUX_GATEWAY_SPACE 0
127 123
128/* This governs the relationship between virtual and physical addresses. 124/* This governs the relationship between virtual and physical addresses.
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index cffdf0eb0df6..e088545cb3f5 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -119,9 +119,6 @@ extern phys_addr_t kernstart_addr;
119/* align addr on a size boundary - adjust address up if needed */ 119/* align addr on a size boundary - adjust address up if needed */
120#define _ALIGN(addr,size) _ALIGN_UP(addr,size) 120#define _ALIGN(addr,size) _ALIGN_UP(addr,size)
121 121
122/* to align the pointer to the (next) page boundary */
123#define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE)
124
125/* 122/*
126 * Don't compare things with KERNELBASE or PAGE_OFFSET to test for 123 * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
127 * "kernelness", use is_kernel_addr() - it should do what you want. 124 * "kernelness", use is_kernel_addr() - it should do what you want.
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index 12fd9c4f0f15..991ba939408c 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -138,9 +138,6 @@ void arch_alloc_page(struct page *page, int order);
138 138
139#endif /* !__ASSEMBLY__ */ 139#endif /* !__ASSEMBLY__ */
140 140
141/* to align the pointer to the (next) page boundary */
142#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
143
144#define __PAGE_OFFSET 0x0UL 141#define __PAGE_OFFSET 0x0UL
145#define PAGE_OFFSET 0x0UL 142#define PAGE_OFFSET 0x0UL
146#define __pa(x) (unsigned long)(x) 143#define __pa(x) (unsigned long)(x)
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 304c30b5d947..5dc01d2fcc4c 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -22,9 +22,6 @@
22#define PAGE_MASK (~(PAGE_SIZE-1)) 22#define PAGE_MASK (~(PAGE_SIZE-1))
23#define PTE_MASK PAGE_MASK 23#define PTE_MASK PAGE_MASK
24 24
25/* to align the pointer to the (next) page boundary */
26#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
27
28#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) 25#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
29#define HPAGE_SHIFT 16 26#define HPAGE_SHIFT 16
30#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K) 27#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
diff --git a/include/asm-sparc/page_32.h b/include/asm-sparc/page_32.h
index 14de518cc38f..cf5fb70ca1c1 100644
--- a/include/asm-sparc/page_32.h
+++ b/include/asm-sparc/page_32.h
@@ -134,9 +134,6 @@ BTFIXUPDEF_SETHI(sparc_unmapped_base)
134 134
135#endif /* !(__ASSEMBLY__) */ 135#endif /* !(__ASSEMBLY__) */
136 136
137/* to align the pointer to the (next) page boundary */
138#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
139
140#define PAGE_OFFSET 0xf0000000 137#define PAGE_OFFSET 0xf0000000
141#ifndef __ASSEMBLY__ 138#ifndef __ASSEMBLY__
142extern unsigned long phys_base; 139extern unsigned long phys_base;
diff --git a/include/asm-sparc/page_64.h b/include/asm-sparc/page_64.h
index a8a2bba032c1..b579b910ef51 100644
--- a/include/asm-sparc/page_64.h
+++ b/include/asm-sparc/page_64.h
@@ -106,9 +106,6 @@ typedef struct page *pgtable_t;
106 106
107#endif /* !(__ASSEMBLY__) */ 107#endif /* !(__ASSEMBLY__) */
108 108
109/* to align the pointer to the (next) page boundary */
110#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
111
112/* We used to stick this into a hard-coded global register (%g4) 109/* We used to stick this into a hard-coded global register (%g4)
113 * but that does not make sense anymore. 110 * but that does not make sense anymore.
114 */ 111 */
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 916e1a61999f..335c57383c02 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -92,9 +92,6 @@ typedef struct page *pgtable_t;
92#define __pgd(x) ((pgd_t) { (x) } ) 92#define __pgd(x) ((pgd_t) { (x) } )
93#define __pgprot(x) ((pgprot_t) { (x) } ) 93#define __pgprot(x) ((pgprot_t) { (x) } )
94 94
95/* to align the pointer to the (next) page boundary */
96#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
97
98extern unsigned long uml_physmem; 95extern unsigned long uml_physmem;
99 96
100#define PAGE_OFFSET (uml_physmem) 97#define PAGE_OFFSET (uml_physmem)
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index 74a539a9bd59..f9de35d873fa 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -94,10 +94,6 @@ typedef unsigned long pgprot_t;
94#endif /* !__ASSEMBLY__ */ 94#endif /* !__ASSEMBLY__ */
95 95
96 96
97/* to align the pointer to the (next) page boundary */
98#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
99
100
101/* No current v850 processor has virtual memory. */ 97/* No current v850 processor has virtual memory. */
102#define __virt_to_phys(addr) (addr) 98#define __virt_to_phys(addr) (addr)
103#define __phys_to_virt(addr) (addr) 99#define __phys_to_virt(addr) (addr)
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index 6e02098b1605..49982110e4d9 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -34,9 +34,6 @@
34 34
35#define HUGE_MAX_HSTATE 2 35#define HUGE_MAX_HSTATE 2
36 36
37/* to align the pointer to the (next) page boundary */
38#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
39
40#ifndef __ASSEMBLY__ 37#ifndef __ASSEMBLY__
41#include <linux/types.h> 38#include <linux/types.h>
42#endif 39#endif
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h
index 80a6ae0dd259..11f7dc2dbec7 100644
--- a/include/asm-xtensa/page.h
+++ b/include/asm-xtensa/page.h
@@ -26,13 +26,11 @@
26 26
27/* 27/*
28 * PAGE_SHIFT determines the page size 28 * PAGE_SHIFT determines the page size
29 * PAGE_ALIGN(x) aligns the pointer to the (next) page boundary
30 */ 29 */
31 30
32#define PAGE_SHIFT 12 31#define PAGE_SHIFT 12
33#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT) 32#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT)
34#define PAGE_MASK (~(PAGE_SIZE-1)) 33#define PAGE_MASK (~(PAGE_SIZE-1))
35#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE - 1) & PAGE_MASK)
36 34
37#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR 35#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR
38#define MAX_MEM_PFN XCHAL_KSEG_SIZE 36#define MAX_MEM_PFN XCHAL_KSEG_SIZE
diff --git a/include/linux/mm.h b/include/linux/mm.h
index df322fb4df31..d87a5a5fe87d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -41,6 +41,9 @@ extern unsigned long mmap_min_addr;
41 41
42#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) 42#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
43 43
44/* to align the pointer to the (next) page boundary */
45#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
46
44/* 47/*
45 * Linux kernel virtual memory manager primitives. 48 * Linux kernel virtual memory manager primitives.
46 * The idea being to have a "virtual" mm in the same way 49 * The idea being to have a "virtual" mm in the same way