diff options
author | Zhang Yanfei <zhangyanfei@cn.fujitsu.com> | 2013-05-09 11:57:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-05-10 06:00:35 -0400 |
commit | cf8b166d5c1c89aad6c436a954fa40fd18a75bfb (patch) | |
tree | b3bff1e70ada5a9c279a899f53b111ce4b1e038e /arch | |
parent | 074d72ff57f65de779e2f70d5906964c0ba1c123 (diff) |
x86/mm: Add missing comments for initial kernel direct mapping
Two sets of comments were lost during patch-series shuffling:
- comments for init_range_memory_mapping()
- comments in init_mem_mapping that is helpful for reminding people
that the pagetable is setup top-down
The comments were written by Yinghai in his patch in:
https://lkml.org/lkml/2012/11/28/620
This patch reintroduces them.
Originally-From: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/518BC776.7010506@gmail.com
[ Tidied it all up a bit. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/init.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index fdc5dca14fb3..eaac1743def7 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -359,7 +359,17 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
359 | } | 359 | } |
360 | 360 | ||
361 | /* | 361 | /* |
362 | * would have hole in the middle or ends, and only ram parts will be mapped. | 362 | * We need to iterate through the E820 memory map and create direct mappings |
363 | * for only E820_RAM and E820_KERN_RESERVED regions. We cannot simply | ||
364 | * create direct mappings for all pfns from [0 to max_low_pfn) and | ||
365 | * [4GB to max_pfn) because of possible memory holes in high addresses | ||
366 | * that cannot be marked as UC by fixed/variable range MTRRs. | ||
367 | * Depending on the alignment of E820 ranges, this may possibly result | ||
368 | * in using smaller size (i.e. 4K instead of 2M or 1G) page tables. | ||
369 | * | ||
370 | * init_mem_mapping() calls init_range_memory_mapping() with big range. | ||
371 | * That range would have hole in the middle or ends, and only ram parts | ||
372 | * will be mapped in init_range_memory_mapping(). | ||
363 | */ | 373 | */ |
364 | static unsigned long __init init_range_memory_mapping( | 374 | static unsigned long __init init_range_memory_mapping( |
365 | unsigned long r_start, | 375 | unsigned long r_start, |
@@ -419,6 +429,13 @@ void __init init_mem_mapping(void) | |||
419 | max_pfn_mapped = 0; /* will get exact value next */ | 429 | max_pfn_mapped = 0; /* will get exact value next */ |
420 | min_pfn_mapped = real_end >> PAGE_SHIFT; | 430 | min_pfn_mapped = real_end >> PAGE_SHIFT; |
421 | last_start = start = real_end; | 431 | last_start = start = real_end; |
432 | |||
433 | /* | ||
434 | * We start from the top (end of memory) and go to the bottom. | ||
435 | * The memblock_find_in_range() gets us a block of RAM from the | ||
436 | * end of RAM in [min_pfn_mapped, max_pfn_mapped) used as new pages | ||
437 | * for page table. | ||
438 | */ | ||
422 | while (last_start > ISA_END_ADDRESS) { | 439 | while (last_start > ISA_END_ADDRESS) { |
423 | if (last_start > step_size) { | 440 | if (last_start > step_size) { |
424 | start = round_down(last_start - 1, step_size); | 441 | start = round_down(last_start - 1, step_size); |