xen: delay construction of mfn_list_list
Subsystems (2)
Juergen Gross
maintainerPATCH 1/1 xen: delay construction of mfn_list_list
The 3 level p2m tree for the Xen tools is constructed very early at boot by calling xen_build_mfn_list_list(). Memory needed for this tree is allocated via extend_brk().
As this tree (other than the kernel internal p2m tree) is only needed for domain save/restore, live migration and crash dump analysis it doesn't matter whether it is constructed very early or just some milliseconds later when memory allocation is possible by other means.
This patch moves the call of xen_build_mfn_list_list() just after calling xen_pagetable_p2m_copy() simplifying this function, too, as it doesn't have to bother with two parallel trees now. The same applies for some other internal functions.
While simplifying code, make early_can_reuse_p2m_middle() static and drop the unused second parameter. p2m_mid_identity_mfn can be removed as well, it isn't used either.
--- arch/x86/xen/enlighten.c | 3 --- arch/x86/xen/mmu.c | 5 +++- arch/x86/xen/p2m.c | 65 +++++++++++------------------------------------- 3 files changed, 18 insertions(+), 55 deletions(-)
arch/x86/xen/enlighten.c +0 -3
@@ -1636,9 +1636,6 @@ asmlinkage __visible void __init xen_start_kernel(void)xen_raw_console_write ("mapping kernel into physical memory\n" );xen_setup_kernel_pagetable ((pgd_t *)xen_start_info->pt_base, xen_start_info->nr_pages); -/* Allocate and initialize top and mid mfn levels for p2m structure */ -xen_build_mfn_list_list (); -/* keep using Xen gdt for now; no urgent need to change it */ #ifdef CONFIG_X86_32
arch/x86/xen/mmu.c +4 -1
@@ -1217,10 +1217,13 @@ static void __init xen_pagetable_p2m_copy(void)static void __init xen_pagetable_init (void ) {paging_init (); -xen_setup_shared_info ();#ifdef CONFIG_X86_64 xen_pagetable_p2m_copy ();#endif +/* Allocate and initialize top and mid mfn levels for p2m structure */ +xen_build_mfn_list_list (); + +xen_setup_shared_info ();xen_post_allocator_init (); }static void xen_write_cr2 (unsigned long cr2)
arch/x86/xen/p2m.c +14 -51
186 lines not on this page · raw message
Signature · 1 line
1.8.4.5
David Vrabel
AppliedQuoted 18 lines · Juergen Gross
The 3 level p2m tree for the Xen tools is constructed very early at boot by calling
xen_build_mfn_list_list(). Memory needed for this tree is allocated viaextend_brk().As this tree (other than the kernel internal p2m tree) is only needed for domain save/restore, live migration and crash dump analysis it doesn't matter whether it is constructed very early or just some milliseconds later when memory allocation is possible by other means.
This patch moves the call of
xen_build_mfn_list_list()just after callingxen_pagetable_p2m_copy()simplifying this function, too, as it doesn't have to bother with two parallel trees now. The same applies for some other internal functions.While simplifying code, make
early_can_reuse_p2m_middle()static and drop the unused second parameter.p2m_mid_identity_mfncan be removed as well, it isn't used either.
Quoted 6 lines
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 3 --- arch/x86/xen/mmu.c | 5 +++- arch/x86/xen/p2m.c | 65 +++++++++++------------------------------------- 3 files changed, 18 insertions(+), 55 deletions(-)
Nice!
Applied to stable/for-linus-3.18
Thanks.
David