From 6f84f8d1587f20f60592cf1b1792ca639f37d429 Mon Sep 17 00:00:00 2001 From: Pavel Tatashin Date: Tue, 10 Apr 2018 16:36:10 -0700 Subject: xen, mm: allow deferred page initialization for xen pv domains Juergen Gross noticed that commit f7f99100d8d ("mm: stop zeroing memory during allocation in vmemmap") broke XEN PV domains when deferred struct page initialization is enabled. This is because the xen's PagePinned() flag is getting erased from struct pages when they are initialized later in boot. Juergen fixed this problem by disabling deferred pages on xen pv domains. It is desirable, however, to have this feature available as it reduces boot time. This fix re-enables the feature for pv-dmains, and fixes the problem the following way: The fix is to delay setting PagePinned flag until struct pages for all allocated memory are initialized, i.e. until after free_all_bootmem(). A new x86_init.hyper op init_after_bootmem() is called to let xen know that boot allocator is done, and hence struct pages for all the allocated memory are now initialized. If deferred page initialization is enabled, the rest of struct pages are going to be initialized later in boot once page_alloc_init_late() is called. xen_after_bootmem() walks page table's pages and marks them pinned. Link: http://lkml.kernel.org/r/20180226160112.24724-2-pasha.tatashin@oracle.com Signed-off-by: Pavel Tatashin Acked-by: Ingo Molnar Reviewed-by: Juergen Gross Tested-by: Juergen Gross Cc: Daniel Jordan Cc: Pavel Tatashin Cc: Alok Kataria Cc: Thomas Gleixner Cc: "H. Peter Anvin" Cc: Boris Ostrovsky Cc: Michal Hocko Cc: Vlastimil Babka Cc: Andy Lutomirski Cc: Laura Abbott Cc: Kirill A. Shutemov Cc: Borislav Petkov Cc: Mathias Krause Cc: Jinbum Park Cc: Dan Williams Cc: Baoquan He Cc: Jia Zhang Cc: Mel Gorman Cc: Johannes Weiner Cc: Stefano Stabellini Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/x86/include/asm/x86_init.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/x86/include/asm/x86_init.h') diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 199e15bd3ec5..ce8b4da07e35 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h @@ -122,12 +122,14 @@ struct x86_init_pci { * @guest_late_init: guest late init * @x2apic_available: X2APIC detection * @init_mem_mapping: setup early mappings during init_mem_mapping() + * @init_after_bootmem: guest init after boot allocator is finished */ struct x86_hyper_init { void (*init_platform)(void); void (*guest_late_init)(void); bool (*x2apic_available)(void); void (*init_mem_mapping)(void); + void (*init_after_bootmem)(void); }; /** -- cgit