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 --- mm/page_alloc.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'mm') diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b4390db64da3..905db9d7962f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -317,9 +316,6 @@ static inline bool update_defer_init(pg_data_t *pgdat, /* Always populate low zones for address-constrained allocations */ if (zone_end < pgdat_end_pfn(pgdat)) return true; - /* Xen PV domains need page structures early */ - if (xen_pv_domain()) - return true; (*nr_initialised)++; if ((*nr_initialised > pgdat->static_init_pgcnt) && (pfn & (PAGES_PER_SECTION - 1)) == 0) { -- cgit v1.2.3