Re: [PATCH] x86: use add_highpages_with_active_regions for high pages init
From: Yinghai Lu
Date: Mon Jun 16 2008 - 00:40:09 EST
On Sun, Jun 15, 2008 at 8:46 PM, Yinghai Lu <yhlu.kernel@xxxxxxxxx> wrote:
> On Sun, Jun 15, 2008 at 6:20 PM, Huang, Ying <ying.huang@xxxxxxxxx> wrote:
>> On Sat, 2008-06-14 at 02:05 -0700, Yinghai Lu wrote:
>>> On Sat, Jun 14, 2008 at 1:23 AM, Ingo Molnar <mingo@xxxxxxx> wrote:
>>> >
>>> > * Yinghai Lu <yhlu.kernel@xxxxxxxxx> wrote:
>>> >
>>> >> use early_node_map to init high pages, so can remove page_is_ram and
>>> >> page_is_reserved_early in the big loop with add_one_highpage
>>> >>
>>> >> also remove the page_is_reserved_early that is not needed.
>>> >
>>> > applied to tip/x86/mpparse for testing, thanks.
>>> >
>>> > Andrew: mm/page_alloc.c modification.
>>>
>>> Ying Huang,
>>>
>>> I removed page_is_reserved_early....it cause init highmem take extra
>>> time on my big box.
>>
>> OK.
>>
>>> please check efi_reserve_early that is calling reserve_early. so need
>>> to make sure "EFI memmap" is reserved in itself...otherwise you may
>>> need to update e820 table by add_memory_region (....,
>>> E820_RESERVED)...
>>
>> EFI memmap may be in highmem, it can not be reserved by bootmem
>> allocator on i386. So I think it is necessary to have an early highmem
>> allocator. It can be used for EFI memory map and linked list of setup
>> data which comes from boot-loader and may be located in highmem.
>>
>> As for the implementation, what about adding a remove_active_range()
>> which operate on early_node_map and an early_res_to_early_node_map()?
>
> don't need,
> EFI memmap should be reserved in e820map, so it should not show up in
> early_node_map.
> if it is not reserved in e820map, you could use e820_add_region or
> e820_update_range make it reserved
something like attached patch
YH
[PATCH] x86: reserve efi map itself in e820 map
Signed-off-by: Yinghai Lu <yhlu.kernel@xxxxxxxxx>
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index d5c7fcd..f0869bb 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -235,6 +235,8 @@ static void __init add_efi_memmap(void)
e820_type = E820_RESERVED;
e820_add_region(start, size, e820_type);
}
+ e820_add_region(memmap.phys_map, memmap.nr_map * memmap.desc_size,
+ E820_RESERVED);
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
}
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index de2645e..5fa241e 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -370,6 +370,9 @@ void __init setup_arch(char **cmdline_p)
early_gart_iommu_check();
+ if (efi_enabled)
+ efi_init();
+
e820_register_active_regions(0, 0, -1UL);
/*
* partially used pages are not usable - thus
@@ -392,8 +395,6 @@ void __init setup_arch(char **cmdline_p)
check_efer();
max_pfn_mapped = init_memory_mapping(0, (end_pfn << PAGE_SHIFT));
- if (efi_enabled)
- efi_init();
vsmp_init();