diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-09-03 18:54:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:05:39 -0400 |
commit | fd4fd5aac1282825195c6816ed40a2a6d42db5bf (patch) | |
tree | 5908cf4c88a7c9d69ea7bdc1c354d51b6ff47f86 /include/asm-um | |
parent | 28ae55c98e4d16eac9a05a8a259d7763ef3aeb18 (diff) |
[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>
Diffstat (limited to 'include/asm-um')
-rw-r--r-- | include/asm-um/page.h | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/include/asm-um/page.h b/include/asm-um/page.h index f58aedadeb4..bd850a24918 100644 --- a/include/asm-um/page.h +++ b/include/asm-um/page.h | |||
@@ -116,24 +116,12 @@ extern void *to_virt(unsigned long phys); | |||
116 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | 116 | #define pfn_valid(pfn) ((pfn) < max_mapnr) |
117 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) | 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 | extern struct page *arch_validate(struct page *page, int mask, int order); | 119 | extern struct page *arch_validate(struct page *page, int mask, int order); |
134 | #define HAVE_ARCH_VALIDATE | 120 | #define HAVE_ARCH_VALIDATE |
135 | 121 | ||
136 | extern void arch_free_page(struct page *page, int order); | 122 | extern void arch_free_page(struct page *page, int order); |
137 | #define HAVE_ARCH_FREE_PAGE | 123 | #define HAVE_ARCH_FREE_PAGE |
138 | 124 | ||
125 | #include <asm-generic/page.h> | ||
126 | |||
139 | #endif | 127 | #endif |