Commit fd4fd5aac1282825195c6816ed40a2a6d42db5bf
Committed by
Linus Torvalds
1 parent
28ae55c98e
Exists in
master
and in
7 other branches
[PATCH] mm: consolidate get_order
Someone mentioned that almost all the architectures used basically the same implementation of get_order. This patch consolidates them into asm-generic/page.h and includes that in the appropriate places. The exceptions are ia64 and ppc which have their own (presumably optimised) versions. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 22 changed files with 69 additions and 312 deletions Side-by-side Diff
- include/asm-alpha/page.h
- include/asm-arm/page.h
- include/asm-arm26/page.h
- include/asm-cris/page.h
- include/asm-frv/page.h
- include/asm-generic/page.h
- include/asm-h8300/page.h
- include/asm-i386/page.h
- include/asm-m32r/page.h
- include/asm-m68k/page.h
- include/asm-m68knommu/page.h
- include/asm-mips/page.h
- include/asm-parisc/page.h
- include/asm-ppc64/page.h
- include/asm-s390/page.h
- include/asm-sh/page.h
- include/asm-sh64/page.h
- include/asm-sparc/page.h
- include/asm-sparc64/page.h
- include/asm-um/page.h
- include/asm-v850/page.h
- include/asm-x86_64/page.h
include/asm-alpha/page.h
... | ... | @@ -63,20 +63,6 @@ |
63 | 63 | |
64 | 64 | #endif /* STRICT_MM_TYPECHECKS */ |
65 | 65 | |
66 | -/* Pure 2^n version of get_order */ | |
67 | -extern __inline__ int get_order(unsigned long size) | |
68 | -{ | |
69 | - int order; | |
70 | - | |
71 | - size = (size-1) >> (PAGE_SHIFT-1); | |
72 | - order = -1; | |
73 | - do { | |
74 | - size >>= 1; | |
75 | - order++; | |
76 | - } while (size); | |
77 | - return order; | |
78 | -} | |
79 | - | |
80 | 66 | #ifdef USE_48_BIT_KSEG |
81 | 67 | #define PAGE_OFFSET 0xffff800000000000UL |
82 | 68 | #else |
... | ... | @@ -111,6 +97,8 @@ |
111 | 97 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
112 | 98 | |
113 | 99 | #endif /* __KERNEL__ */ |
100 | + | |
101 | +#include <asm-generic/page.h> | |
114 | 102 | |
115 | 103 | #endif /* _ALPHA_PAGE_H */ |
include/asm-arm/page.h
... | ... | @@ -163,20 +163,6 @@ |
163 | 163 | /* the upper-most page table pointer */ |
164 | 164 | extern pmd_t *top_pmd; |
165 | 165 | |
166 | -/* Pure 2^n version of get_order */ | |
167 | -static inline int get_order(unsigned long size) | |
168 | -{ | |
169 | - int order; | |
170 | - | |
171 | - size = (size-1) >> (PAGE_SHIFT-1); | |
172 | - order = -1; | |
173 | - do { | |
174 | - size >>= 1; | |
175 | - order++; | |
176 | - } while (size); | |
177 | - return order; | |
178 | -} | |
179 | - | |
180 | 166 | #include <asm/memory.h> |
181 | 167 | |
182 | 168 | #endif /* !__ASSEMBLY__ */ |
... | ... | @@ -185,6 +171,8 @@ |
185 | 171 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
186 | 172 | |
187 | 173 | #endif /* __KERNEL__ */ |
174 | + | |
175 | +#include <asm-generic/page.h> | |
188 | 176 | |
189 | 177 | #endif |
include/asm-arm26/page.h
... | ... | @@ -89,20 +89,6 @@ |
89 | 89 | #ifdef __KERNEL__ |
90 | 90 | #ifndef __ASSEMBLY__ |
91 | 91 | |
92 | -/* Pure 2^n version of get_order */ | |
93 | -static inline int get_order(unsigned long size) | |
94 | -{ | |
95 | - int order; | |
96 | - | |
97 | - size = (size-1) >> (PAGE_SHIFT-1); | |
98 | - order = -1; | |
99 | - do { | |
100 | - size >>= 1; | |
101 | - order++; | |
102 | - } while (size); | |
103 | - return order; | |
104 | -} | |
105 | - | |
106 | 92 | #include <asm/memory.h> |
107 | 93 | |
108 | 94 | #endif /* !__ASSEMBLY__ */ |
... | ... | @@ -111,6 +97,8 @@ |
111 | 97 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
112 | 98 | |
113 | 99 | #endif /* __KERNEL__ */ |
100 | + | |
101 | +#include <asm-generic/page.h> | |
114 | 102 | |
115 | 103 | #endif |
include/asm-cris/page.h
... | ... | @@ -70,25 +70,14 @@ |
70 | 70 | |
71 | 71 | #ifndef __ASSEMBLY__ |
72 | 72 | |
73 | -/* Pure 2^n version of get_order */ | |
74 | -static inline int get_order(unsigned long size) | |
75 | -{ | |
76 | - int order; | |
77 | - | |
78 | - size = (size-1) >> (PAGE_SHIFT-1); | |
79 | - order = -1; | |
80 | - do { | |
81 | - size >>= 1; | |
82 | - order++; | |
83 | - } while (size); | |
84 | - return order; | |
85 | -} | |
86 | 73 | #endif /* __ASSEMBLY__ */ |
87 | 74 | |
88 | 75 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
89 | 76 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
90 | 77 | |
91 | 78 | #endif /* __KERNEL__ */ |
79 | + | |
80 | +#include <asm-generic/page.h> | |
92 | 81 | |
93 | 82 | #endif /* _CRIS_PAGE_H */ |
include/asm-frv/page.h
... | ... | @@ -45,21 +45,6 @@ |
45 | 45 | /* to align the pointer to the (next) page boundary */ |
46 | 46 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) |
47 | 47 | |
48 | -/* Pure 2^n version of get_order */ | |
49 | -static inline int get_order(unsigned long size) __attribute_const__; | |
50 | -static inline int get_order(unsigned long size) | |
51 | -{ | |
52 | - int order; | |
53 | - | |
54 | - size = (size - 1) >> (PAGE_SHIFT - 1); | |
55 | - order = -1; | |
56 | - do { | |
57 | - size >>= 1; | |
58 | - order++; | |
59 | - } while (size); | |
60 | - return order; | |
61 | -} | |
62 | - | |
63 | 48 | #define devmem_is_allowed(pfn) 1 |
64 | 49 | |
65 | 50 | #define __pa(vaddr) virt_to_phys((void *) vaddr) |
... | ... | @@ -101,6 +86,8 @@ |
101 | 86 | #ifdef CONFIG_CONTIGUOUS_PAGE_ALLOC |
102 | 87 | #define WANT_PAGE_VIRTUAL 1 |
103 | 88 | #endif |
89 | + | |
90 | +#include <asm-generic/page.h> | |
104 | 91 | |
105 | 92 | #endif /* _ASM_PAGE_H */ |
include/asm-generic/page.h
1 | +#ifndef _ASM_GENERIC_PAGE_H | |
2 | +#define _ASM_GENERIC_PAGE_H | |
3 | + | |
4 | +#ifdef __KERNEL__ | |
5 | +#ifndef __ASSEMBLY__ | |
6 | + | |
7 | +#include <linux/compiler.h> | |
8 | + | |
9 | +/* Pure 2^n version of get_order */ | |
10 | +static __inline__ __attribute_const__ int get_order(unsigned long size) | |
11 | +{ | |
12 | + int order; | |
13 | + | |
14 | + size = (size - 1) >> (PAGE_SHIFT - 1); | |
15 | + order = -1; | |
16 | + do { | |
17 | + size >>= 1; | |
18 | + order++; | |
19 | + } while (size); | |
20 | + return order; | |
21 | +} | |
22 | + | |
23 | +#endif /* __ASSEMBLY__ */ | |
24 | +#endif /* __KERNEL__ */ | |
25 | + | |
26 | +#endif /* _ASM_GENERIC_PAGE_H */ |
include/asm-h8300/page.h
... | ... | @@ -54,20 +54,6 @@ |
54 | 54 | /* to align the pointer to the (next) page boundary */ |
55 | 55 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
56 | 56 | |
57 | -/* Pure 2^n version of get_order */ | |
58 | -extern __inline__ int get_order(unsigned long size) | |
59 | -{ | |
60 | - int order; | |
61 | - | |
62 | - size = (size-1) >> (PAGE_SHIFT-1); | |
63 | - order = -1; | |
64 | - do { | |
65 | - size >>= 1; | |
66 | - order++; | |
67 | - } while (size); | |
68 | - return order; | |
69 | -} | |
70 | - | |
71 | 57 | extern unsigned long memory_start; |
72 | 58 | extern unsigned long memory_end; |
73 | 59 | |
... | ... | @@ -100,6 +86,8 @@ |
100 | 86 | #endif /* __ASSEMBLY__ */ |
101 | 87 | |
102 | 88 | #endif /* __KERNEL__ */ |
89 | + | |
90 | +#include <asm-generic/page.h> | |
103 | 91 | |
104 | 92 | #endif /* _H8300_PAGE_H */ |
include/asm-i386/page.h
... | ... | @@ -104,20 +104,6 @@ |
104 | 104 | */ |
105 | 105 | extern unsigned int __VMALLOC_RESERVE; |
106 | 106 | |
107 | -/* Pure 2^n version of get_order */ | |
108 | -static __inline__ int get_order(unsigned long size) | |
109 | -{ | |
110 | - int order; | |
111 | - | |
112 | - size = (size-1) >> (PAGE_SHIFT-1); | |
113 | - order = -1; | |
114 | - do { | |
115 | - size >>= 1; | |
116 | - order++; | |
117 | - } while (size); | |
118 | - return order; | |
119 | -} | |
120 | - | |
121 | 107 | extern int sysctl_legacy_va_layout; |
122 | 108 | |
123 | 109 | extern int page_is_ram(unsigned long pagenr); |
... | ... | @@ -155,6 +141,8 @@ |
155 | 141 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
156 | 142 | |
157 | 143 | #endif /* __KERNEL__ */ |
144 | + | |
145 | +#include <asm-generic/page.h> | |
158 | 146 | |
159 | 147 | #endif /* _I386_PAGE_H */ |
include/asm-m32r/page.h
... | ... | @@ -61,25 +61,6 @@ |
61 | 61 | |
62 | 62 | /* This handles the memory map.. */ |
63 | 63 | |
64 | -#ifndef __ASSEMBLY__ | |
65 | - | |
66 | -/* Pure 2^n version of get_order */ | |
67 | -static __inline__ int get_order(unsigned long size) | |
68 | -{ | |
69 | - int order; | |
70 | - | |
71 | - size = (size - 1) >> (PAGE_SHIFT - 1); | |
72 | - order = -1; | |
73 | - do { | |
74 | - size >>= 1; | |
75 | - order++; | |
76 | - } while (size); | |
77 | - | |
78 | - return order; | |
79 | -} | |
80 | - | |
81 | -#endif /* __ASSEMBLY__ */ | |
82 | - | |
83 | 64 | #define __MEMORY_START CONFIG_MEMORY_START |
84 | 65 | #define __MEMORY_SIZE CONFIG_MEMORY_SIZE |
85 | 66 | |
... | ... | @@ -110,6 +91,8 @@ |
110 | 91 | #define devmem_is_allowed(x) 1 |
111 | 92 | |
112 | 93 | #endif /* __KERNEL__ */ |
94 | + | |
95 | +#include <asm-generic/page.h> | |
113 | 96 | |
114 | 97 | #endif /* _ASM_M32R_PAGE_H */ |
include/asm-m68k/page.h
... | ... | @@ -107,20 +107,6 @@ |
107 | 107 | /* to align the pointer to the (next) page boundary */ |
108 | 108 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
109 | 109 | |
110 | -/* Pure 2^n version of get_order */ | |
111 | -static inline int get_order(unsigned long size) | |
112 | -{ | |
113 | - int order; | |
114 | - | |
115 | - size = (size-1) >> (PAGE_SHIFT-1); | |
116 | - order = -1; | |
117 | - do { | |
118 | - size >>= 1; | |
119 | - order++; | |
120 | - } while (size); | |
121 | - return order; | |
122 | -} | |
123 | - | |
124 | 110 | #endif /* !__ASSEMBLY__ */ |
125 | 111 | |
126 | 112 | #include <asm/page_offset.h> |
... | ... | @@ -191,6 +177,8 @@ |
191 | 177 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
192 | 178 | |
193 | 179 | #endif /* __KERNEL__ */ |
180 | + | |
181 | +#include <asm-generic/page.h> | |
194 | 182 | |
195 | 183 | #endif /* _M68K_PAGE_H */ |
include/asm-m68knommu/page.h
... | ... | @@ -48,20 +48,6 @@ |
48 | 48 | /* to align the pointer to the (next) page boundary */ |
49 | 49 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) |
50 | 50 | |
51 | -/* Pure 2^n version of get_order */ | |
52 | -extern __inline__ int get_order(unsigned long size) | |
53 | -{ | |
54 | - int order; | |
55 | - | |
56 | - size = (size-1) >> (PAGE_SHIFT-1); | |
57 | - order = -1; | |
58 | - do { | |
59 | - size >>= 1; | |
60 | - order++; | |
61 | - } while (size); | |
62 | - return order; | |
63 | -} | |
64 | - | |
65 | 51 | extern unsigned long memory_start; |
66 | 52 | extern unsigned long memory_end; |
67 | 53 | |
... | ... | @@ -92,6 +78,8 @@ |
92 | 78 | #endif /* __ASSEMBLY__ */ |
93 | 79 | |
94 | 80 | #endif /* __KERNEL__ */ |
81 | + | |
82 | +#include <asm-generic/page.h> | |
95 | 83 | |
96 | 84 | #endif /* _M68KNOMMU_PAGE_H */ |
include/asm-mips/page.h
... | ... | @@ -103,20 +103,6 @@ |
103 | 103 | #define __pgd(x) ((pgd_t) { (x) } ) |
104 | 104 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
105 | 105 | |
106 | -/* Pure 2^n version of get_order */ | |
107 | -static __inline__ int get_order(unsigned long size) | |
108 | -{ | |
109 | - int order; | |
110 | - | |
111 | - size = (size-1) >> (PAGE_SHIFT-1); | |
112 | - order = -1; | |
113 | - do { | |
114 | - size >>= 1; | |
115 | - order++; | |
116 | - } while (size); | |
117 | - return order; | |
118 | -} | |
119 | - | |
120 | 106 | #endif /* !__ASSEMBLY__ */ |
121 | 107 | |
122 | 108 | /* to align the pointer to the (next) page boundary */ |
... | ... | @@ -147,6 +133,8 @@ |
147 | 133 | #ifdef CONFIG_LIMITED_DMA |
148 | 134 | #define WANT_PAGE_VIRTUAL |
149 | 135 | #endif |
136 | + | |
137 | +#include <asm-generic/page.h> | |
150 | 138 | |
151 | 139 | #endif /* _ASM_PAGE_H */ |
include/asm-parisc/page.h
... | ... | @@ -74,20 +74,6 @@ |
74 | 74 | #define __pgd(x) ((pgd_t) { (x) } ) |
75 | 75 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
76 | 76 | |
77 | -/* Pure 2^n version of get_order */ | |
78 | -extern __inline__ int get_order(unsigned long size) | |
79 | -{ | |
80 | - int order; | |
81 | - | |
82 | - size = (size-1) >> (PAGE_SHIFT-1); | |
83 | - order = -1; | |
84 | - do { | |
85 | - size >>= 1; | |
86 | - order++; | |
87 | - } while (size); | |
88 | - return order; | |
89 | -} | |
90 | - | |
91 | 77 | typedef struct __physmem_range { |
92 | 78 | unsigned long start_pfn; |
93 | 79 | unsigned long pages; /* PAGE_SIZE pages */ |
... | ... | @@ -158,6 +144,8 @@ |
158 | 144 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
159 | 145 | |
160 | 146 | #endif /* __KERNEL__ */ |
147 | + | |
148 | +#include <asm-generic/page.h> | |
161 | 149 | |
162 | 150 | #endif /* _PARISC_PAGE_H */ |
include/asm-ppc64/page.h
... | ... | @@ -172,20 +172,6 @@ |
172 | 172 | |
173 | 173 | #endif |
174 | 174 | |
175 | -/* Pure 2^n version of get_order */ | |
176 | -static inline int get_order(unsigned long size) | |
177 | -{ | |
178 | - int order; | |
179 | - | |
180 | - size = (size-1) >> (PAGE_SHIFT-1); | |
181 | - order = -1; | |
182 | - do { | |
183 | - size >>= 1; | |
184 | - order++; | |
185 | - } while (size); | |
186 | - return order; | |
187 | -} | |
188 | - | |
189 | 175 | #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) |
190 | 176 | |
191 | 177 | extern int page_is_ram(unsigned long pfn); |
... | ... | @@ -270,5 +256,8 @@ |
270 | 256 | VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64) |
271 | 257 | |
272 | 258 | #endif /* __KERNEL__ */ |
259 | + | |
260 | +#include <asm-generic/page.h> | |
261 | + | |
273 | 262 | #endif /* _PPC64_PAGE_H */ |
include/asm-s390/page.h
... | ... | @@ -111,20 +111,6 @@ |
111 | 111 | #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr) |
112 | 112 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
113 | 113 | |
114 | -/* Pure 2^n version of get_order */ | |
115 | -extern __inline__ int get_order(unsigned long size) | |
116 | -{ | |
117 | - int order; | |
118 | - | |
119 | - size = (size-1) >> (PAGE_SHIFT-1); | |
120 | - order = -1; | |
121 | - do { | |
122 | - size >>= 1; | |
123 | - order++; | |
124 | - } while (size); | |
125 | - return order; | |
126 | -} | |
127 | - | |
128 | 114 | /* |
129 | 115 | * These are used to make use of C type-checking.. |
130 | 116 | */ |
... | ... | @@ -206,6 +192,8 @@ |
206 | 192 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
207 | 193 | |
208 | 194 | #endif /* __KERNEL__ */ |
195 | + | |
196 | +#include <asm-generic/page.h> | |
209 | 197 | |
210 | 198 | #endif /* _S390_PAGE_H */ |
include/asm-sh/page.h
... | ... | @@ -122,25 +122,9 @@ |
122 | 122 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
123 | 123 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
124 | 124 | |
125 | -#ifndef __ASSEMBLY__ | |
126 | - | |
127 | -/* Pure 2^n version of get_order */ | |
128 | -static __inline__ int get_order(unsigned long size) | |
129 | -{ | |
130 | - int order; | |
131 | - | |
132 | - size = (size-1) >> (PAGE_SHIFT-1); | |
133 | - order = -1; | |
134 | - do { | |
135 | - size >>= 1; | |
136 | - order++; | |
137 | - } while (size); | |
138 | - return order; | |
139 | -} | |
140 | - | |
141 | -#endif | |
142 | - | |
143 | 125 | #endif /* __KERNEL__ */ |
126 | + | |
127 | +#include <asm-generic/page.h> | |
144 | 128 | |
145 | 129 | #endif /* __ASM_SH_PAGE_H */ |
include/asm-sh64/page.h
... | ... | @@ -115,25 +115,9 @@ |
115 | 115 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
116 | 116 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
117 | 117 | |
118 | -#ifndef __ASSEMBLY__ | |
119 | - | |
120 | -/* Pure 2^n version of get_order */ | |
121 | -extern __inline__ int get_order(unsigned long size) | |
122 | -{ | |
123 | - int order; | |
124 | - | |
125 | - size = (size-1) >> (PAGE_SHIFT-1); | |
126 | - order = -1; | |
127 | - do { | |
128 | - size >>= 1; | |
129 | - order++; | |
130 | - } while (size); | |
131 | - return order; | |
132 | -} | |
133 | - | |
134 | -#endif | |
135 | - | |
136 | 118 | #endif /* __KERNEL__ */ |
119 | + | |
120 | +#include <asm-generic/page.h> | |
137 | 121 | |
138 | 122 | #endif /* __ASM_SH64_PAGE_H */ |
include/asm-sparc/page.h
... | ... | @@ -132,20 +132,6 @@ |
132 | 132 | |
133 | 133 | #define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base) |
134 | 134 | |
135 | -/* Pure 2^n version of get_order */ | |
136 | -extern __inline__ int get_order(unsigned long size) | |
137 | -{ | |
138 | - int order; | |
139 | - | |
140 | - size = (size-1) >> (PAGE_SHIFT-1); | |
141 | - order = -1; | |
142 | - do { | |
143 | - size >>= 1; | |
144 | - order++; | |
145 | - } while (size); | |
146 | - return order; | |
147 | -} | |
148 | - | |
149 | 135 | #else /* !(__ASSEMBLY__) */ |
150 | 136 | |
151 | 137 | #define __pgprot(x) (x) |
... | ... | @@ -177,6 +163,8 @@ |
177 | 163 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
178 | 164 | |
179 | 165 | #endif /* __KERNEL__ */ |
166 | + | |
167 | +#include <asm-generic/page.h> | |
180 | 168 | |
181 | 169 | #endif /* _SPARC_PAGE_H */ |
include/asm-sparc64/page.h
... | ... | @@ -150,26 +150,14 @@ |
150 | 150 | |
151 | 151 | extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; |
152 | 152 | |
153 | -/* Pure 2^n version of get_order */ | |
154 | -static __inline__ int get_order(unsigned long size) | |
155 | -{ | |
156 | - int order; | |
157 | - | |
158 | - size = (size-1) >> (PAGE_SHIFT-1); | |
159 | - order = -1; | |
160 | - do { | |
161 | - size >>= 1; | |
162 | - order++; | |
163 | - } while (size); | |
164 | - return order; | |
165 | -} | |
166 | - | |
167 | 153 | #endif /* !(__ASSEMBLY__) */ |
168 | 154 | |
169 | 155 | #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ |
170 | 156 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) |
171 | 157 | |
172 | 158 | #endif /* !(__KERNEL__) */ |
159 | + | |
160 | +#include <asm-generic/page.h> | |
173 | 161 | |
174 | 162 | #endif /* !(_SPARC64_PAGE_H) */ |
include/asm-um/page.h
... | ... | @@ -116,25 +116,13 @@ |
116 | 116 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
117 | 117 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) |
118 | 118 | |
119 | -/* Pure 2^n version of get_order */ | |
120 | -static __inline__ int get_order(unsigned long size) | |
121 | -{ | |
122 | - int order; | |
123 | - | |
124 | - size = (size-1) >> (PAGE_SHIFT-1); | |
125 | - order = -1; | |
126 | - do { | |
127 | - size >>= 1; | |
128 | - order++; | |
129 | - } while (size); | |
130 | - return order; | |
131 | -} | |
132 | - | |
133 | 119 | extern struct page *arch_validate(struct page *page, int mask, int order); |
134 | 120 | #define HAVE_ARCH_VALIDATE |
135 | 121 | |
136 | 122 | extern void arch_free_page(struct page *page, int order); |
137 | 123 | #define HAVE_ARCH_FREE_PAGE |
124 | + | |
125 | +#include <asm-generic/page.h> | |
138 | 126 | |
139 | 127 | #endif |
include/asm-v850/page.h
... | ... | @@ -98,25 +98,6 @@ |
98 | 98 | #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) |
99 | 99 | |
100 | 100 | |
101 | -#ifndef __ASSEMBLY__ | |
102 | - | |
103 | -/* Pure 2^n version of get_order */ | |
104 | -extern __inline__ int get_order (unsigned long size) | |
105 | -{ | |
106 | - int order; | |
107 | - | |
108 | - size = (size-1) >> (PAGE_SHIFT-1); | |
109 | - order = -1; | |
110 | - do { | |
111 | - size >>= 1; | |
112 | - order++; | |
113 | - } while (size); | |
114 | - return order; | |
115 | -} | |
116 | - | |
117 | -#endif /* !__ASSEMBLY__ */ | |
118 | - | |
119 | - | |
120 | 101 | /* No current v850 processor has virtual memory. */ |
121 | 102 | #define __virt_to_phys(addr) (addr) |
122 | 103 | #define __phys_to_virt(addr) (addr) |
... | ... | @@ -143,6 +124,8 @@ |
143 | 124 | |
144 | 125 | |
145 | 126 | #endif /* KERNEL */ |
127 | + | |
128 | +#include <asm-generic/page.h> | |
146 | 129 | |
147 | 130 | #endif /* __V850_PAGE_H__ */ |
include/asm-x86_64/page.h
... | ... | @@ -92,20 +92,6 @@ |
92 | 92 | |
93 | 93 | #include <asm/bug.h> |
94 | 94 | |
95 | -/* Pure 2^n version of get_order */ | |
96 | -extern __inline__ int get_order(unsigned long size) | |
97 | -{ | |
98 | - int order; | |
99 | - | |
100 | - size = (size-1) >> (PAGE_SHIFT-1); | |
101 | - order = -1; | |
102 | - do { | |
103 | - size >>= 1; | |
104 | - order++; | |
105 | - } while (size); | |
106 | - return order; | |
107 | -} | |
108 | - | |
109 | 95 | #endif /* __ASSEMBLY__ */ |
110 | 96 | |
111 | 97 | #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) |
... | ... | @@ -140,6 +126,8 @@ |
140 | 126 | #define __HAVE_ARCH_GATE_AREA 1 |
141 | 127 | |
142 | 128 | #endif /* __KERNEL__ */ |
129 | + | |
130 | +#include <asm-generic/page.h> | |
143 | 131 | |
144 | 132 | #endif /* _X86_64_PAGE_H */ |