diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-11-16 22:39:13 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-11-17 14:59:40 -0500 |
commit | 84d770019bb990dcd8013d9d08174d0e1516b517 (patch) | |
tree | aa49770cef7c3d97e5481168f7585379e85c861f /arch/x86/mm | |
parent | 5a0d3aeeeffbd1534a510fc10c4ab7c99c45afce (diff) |
x86, mm: use PFN_DOWN in split_mem_range()
to replace own inline version for shifting.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1353123563-3103-37-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/init.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 0e625e606e5d..1cca052b2cbd 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -208,8 +208,8 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range, | |||
208 | int i; | 208 | int i; |
209 | 209 | ||
210 | /* head if not big page alignment ? */ | 210 | /* head if not big page alignment ? */ |
211 | start_pfn = start >> PAGE_SHIFT; | 211 | start_pfn = PFN_DOWN(start); |
212 | pos = start_pfn << PAGE_SHIFT; | 212 | pos = PFN_PHYS(start_pfn); |
213 | #ifdef CONFIG_X86_32 | 213 | #ifdef CONFIG_X86_32 |
214 | /* | 214 | /* |
215 | * Don't use a large page for the first 2/4MB of memory | 215 | * Don't use a large page for the first 2/4MB of memory |
@@ -218,59 +218,59 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range, | |||
218 | * slowdowns. | 218 | * slowdowns. |
219 | */ | 219 | */ |
220 | if (pos == 0) | 220 | if (pos == 0) |
221 | end_pfn = PMD_SIZE >> PAGE_SHIFT; | 221 | end_pfn = PFN_DOWN(PMD_SIZE); |
222 | else | 222 | else |
223 | end_pfn = round_up(pos, PMD_SIZE) >> PAGE_SHIFT; | 223 | end_pfn = PFN_DOWN(round_up(pos, PMD_SIZE)); |
224 | #else /* CONFIG_X86_64 */ | 224 | #else /* CONFIG_X86_64 */ |
225 | end_pfn = round_up(pos, PMD_SIZE) >> PAGE_SHIFT; | 225 | end_pfn = PFN_DOWN(round_up(pos, PMD_SIZE)); |
226 | #endif | 226 | #endif |
227 | if (end_pfn > (end >> PAGE_SHIFT)) | 227 | if (end_pfn > PFN_DOWN(end)) |
228 | end_pfn = end >> PAGE_SHIFT; | 228 | end_pfn = PFN_DOWN(end); |
229 | if (start_pfn < end_pfn) { | 229 | if (start_pfn < end_pfn) { |
230 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); | 230 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); |
231 | pos = end_pfn << PAGE_SHIFT; | 231 | pos = PFN_PHYS(end_pfn); |
232 | } | 232 | } |
233 | 233 | ||
234 | /* big page (2M) range */ | 234 | /* big page (2M) range */ |
235 | start_pfn = round_up(pos, PMD_SIZE) >> PAGE_SHIFT; | 235 | start_pfn = PFN_DOWN(round_up(pos, PMD_SIZE)); |
236 | #ifdef CONFIG_X86_32 | 236 | #ifdef CONFIG_X86_32 |
237 | end_pfn = round_down(end, PMD_SIZE) >> PAGE_SHIFT; | 237 | end_pfn = PFN_DOWN(round_down(end, PMD_SIZE)); |
238 | #else /* CONFIG_X86_64 */ | 238 | #else /* CONFIG_X86_64 */ |
239 | end_pfn = round_up(pos, PUD_SIZE) >> PAGE_SHIFT; | 239 | end_pfn = PFN_DOWN(round_up(pos, PUD_SIZE)); |
240 | if (end_pfn > (round_down(end, PMD_SIZE) >> PAGE_SHIFT)) | 240 | if (end_pfn > PFN_DOWN(round_down(end, PMD_SIZE))) |
241 | end_pfn = round_down(end, PMD_SIZE) >> PAGE_SHIFT; | 241 | end_pfn = PFN_DOWN(round_down(end, PMD_SIZE)); |
242 | #endif | 242 | #endif |
243 | 243 | ||
244 | if (start_pfn < end_pfn) { | 244 | if (start_pfn < end_pfn) { |
245 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, | 245 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, |
246 | page_size_mask & (1<<PG_LEVEL_2M)); | 246 | page_size_mask & (1<<PG_LEVEL_2M)); |
247 | pos = end_pfn << PAGE_SHIFT; | 247 | pos = PFN_PHYS(end_pfn); |
248 | } | 248 | } |
249 | 249 | ||
250 | #ifdef CONFIG_X86_64 | 250 | #ifdef CONFIG_X86_64 |
251 | /* big page (1G) range */ | 251 | /* big page (1G) range */ |
252 | start_pfn = round_up(pos, PUD_SIZE) >> PAGE_SHIFT; | 252 | start_pfn = PFN_DOWN(round_up(pos, PUD_SIZE)); |
253 | end_pfn = round_down(end, PUD_SIZE) >> PAGE_SHIFT; | 253 | end_pfn = PFN_DOWN(round_down(end, PUD_SIZE)); |
254 | if (start_pfn < end_pfn) { | 254 | if (start_pfn < end_pfn) { |
255 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, | 255 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, |
256 | page_size_mask & | 256 | page_size_mask & |
257 | ((1<<PG_LEVEL_2M)|(1<<PG_LEVEL_1G))); | 257 | ((1<<PG_LEVEL_2M)|(1<<PG_LEVEL_1G))); |
258 | pos = end_pfn << PAGE_SHIFT; | 258 | pos = PFN_PHYS(end_pfn); |
259 | } | 259 | } |
260 | 260 | ||
261 | /* tail is not big page (1G) alignment */ | 261 | /* tail is not big page (1G) alignment */ |
262 | start_pfn = round_up(pos, PMD_SIZE) >> PAGE_SHIFT; | 262 | start_pfn = PFN_DOWN(round_up(pos, PMD_SIZE)); |
263 | end_pfn = round_down(end, PMD_SIZE) >> PAGE_SHIFT; | 263 | end_pfn = PFN_DOWN(round_down(end, PMD_SIZE)); |
264 | if (start_pfn < end_pfn) { | 264 | if (start_pfn < end_pfn) { |
265 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, | 265 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, |
266 | page_size_mask & (1<<PG_LEVEL_2M)); | 266 | page_size_mask & (1<<PG_LEVEL_2M)); |
267 | pos = end_pfn << PAGE_SHIFT; | 267 | pos = PFN_PHYS(end_pfn); |
268 | } | 268 | } |
269 | #endif | 269 | #endif |
270 | 270 | ||
271 | /* tail is not big page (2M) alignment */ | 271 | /* tail is not big page (2M) alignment */ |
272 | start_pfn = pos>>PAGE_SHIFT; | 272 | start_pfn = PFN_DOWN(pos); |
273 | end_pfn = end>>PAGE_SHIFT; | 273 | end_pfn = PFN_DOWN(end); |
274 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); | 274 | nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); |
275 | 275 | ||
276 | /* try to merge same page size and continuous */ | 276 | /* try to merge same page size and continuous */ |