The patch titled Subject: arm: arm64: introduce CONFIG_HAVE_MEMBLOCK_PFN_VALID has been removed from the -mm tree. Its filename was arm-arm64-introduce-config_have_memblock_pfn_valid.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Jia He <jia.he@xxxxxxxxxxxxxxxx> Subject: arm: arm64: introduce CONFIG_HAVE_MEMBLOCK_PFN_VALID Patch series "optimize memblock_next_valid_pfn and early_pfn_valid on arm and arm64", v10. Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns where possible") optimized the loop in memmap_init_zone(). But it causes possible panic bug. So Daniel Vacek reverted it later. But as suggested by Daniel Vacek, it is fine to using memblock to skip gaps and finding next valid frame with CONFIG_HAVE_ARCH_PFN_VALID. More from what Daniel said: "On arm and arm64, memblock is used by default. But generic version of pfn_valid() is based on mem sections and memblock_next_valid_pfn() does not always return the next valid one but skips more resulting in some valid frames to be skipped (as if they were invalid). And that's why kernel was eventually crashing on some !arm machines." About the performance consideration: As said by James in b92df1de5, "I have tested this patch on a virtual model of a Samurai CPU with a sparse memory map. The kernel boot time drops from 109 to 62 seconds." Thus it would be better if we remain memblock_next_valid_pfn on arm/arm64. Besides we can remain memblock_next_valid_pfn, there is still some room for improvement. After this set, I can see the time overhead of memmap_init is reduced from 27956us to 13537us in my armv8a server(QDF2400 with 96G memory, pagesize 64k). I believe arm server will benefit more if memory is larger than TBs Patch 1 introduces new config to make codes more generic Patch 2 remains the memblock_next_valid_pfn on arm and arm64,this patch is originated from b92df1de5 Patch 3 optimizes the memblock_next_valid_pfn() Patch 4~6 optimizes the early_pfn_valid() This patch (of 6): Make CONFIG_HAVE_MEMBLOCK_PFN_VALID a new config option so it can move memblock_next_valid_pfn to generic code file. All the latter optimizations are based on this config. The memblock initialization time on arm/arm64 can benefit from this. Link: http://lkml.kernel.org/r/1530867675-9018-2-git-send-email-hejianet@xxxxxxxxx Signed-off-by: Jia He <jia.he@xxxxxxxxxxxxxxxx> Reviewed-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> Cc: Pavel Tatashin <pavel.tatashin@xxxxxxxxxxxxx Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Wei Yang <richard.weiyang@xxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Laura Abbott <labbott@xxxxxxxxxx> Cc: Vladimir Murzin <vladimir.murzin@xxxxxxx> Cc: Philip Derrin <philip@cog.systems> Cc: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Steve Capper <steve.capper@xxxxxxx> Cc: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Kemi Wang <kemi.wang@xxxxxxxxx> Cc: Petr Tesarik <ptesarik@xxxxxxxx> Cc: YASUAKI ISHIMATSU <yasu.isimatu@xxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Nikolay Borisov <nborisov@xxxxxxxx> Cc: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx> Cc: Daniel Vacek <neelx@xxxxxxxxxx> Cc: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/arm/Kconfig | 4 ++++ arch/arm64/Kconfig | 4 ++++ mm/Kconfig | 3 +++ 3 files changed, 11 insertions(+) --- a/arch/arm64/Kconfig~arm-arm64-introduce-config_have_memblock_pfn_valid +++ a/arch/arm64/Kconfig @@ -788,6 +788,10 @@ config ARCH_FLATMEM_ENABLE config HAVE_ARCH_PFN_VALID def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM +config HAVE_MEMBLOCK_PFN_VALID + def_bool y + depends on HAVE_ARCH_PFN_VALID + config HW_PERF_EVENTS def_bool y depends on ARM_PMU --- a/arch/arm/Kconfig~arm-arm64-introduce-config_have_memblock_pfn_valid +++ a/arch/arm/Kconfig @@ -1635,6 +1635,10 @@ config ARCH_SELECT_MEMORY_MODEL config HAVE_ARCH_PFN_VALID def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM +config HAVE_MEMBLOCK_PFN_VALID + def_bool y + depends on HAVE_ARCH_PFN_VALID + config HAVE_GENERIC_GUP def_bool y depends on ARM_LPAE --- a/mm/Kconfig~arm-arm64-introduce-config_have_memblock_pfn_valid +++ a/mm/Kconfig @@ -136,6 +136,9 @@ config HAVE_MEMBLOCK_NODE_MAP config HAVE_MEMBLOCK_PHYS_MAP bool +config HAVE_MEMBLOCK_PFN_VALID + bool + config HAVE_GENERIC_GUP bool _ Patches currently in -mm which might be from jia.he@xxxxxxxxxxxxxxxx are mm-page_alloc-remain-memblock_next_valid_pfn-on-arm-arm64.patch mm-page_alloc-reduce-unnecessary-binary-search-in-memblock_next_valid_pfn.patch mm-memblock-introduce-memblock_search_pfn_regions.patch mm-memblock-introduce-pfn_valid_region.patch mm-page_alloc-reduce-unnecessary-binary-search-in-early_pfn_valid.patch