• Xishi Qiu's avatar
    arch/x86/mm/numa.c: fix boot failure when all nodes are hotpluggable · bd5cfb89
    Xishi Qiu authored
    If all the nodes are marked hotpluggable, alloc node data will fail.
    Because __next_mem_range_rev() will skip the hotpluggable memory
    regions.  numa_clear_kernel_node_hotplug() is called after alloc node
    data.
    
    numa_init()
        ...
        ret = init_func();  // this will mark hotpluggable flag from SRAT
        ...
        memblock_set_bottom_up(false);
        ...
        ret = numa_register_memblks(&numa_meminfo);  // this will alloc node data(pglist_data)
        ...
        numa_clear_kernel_node_hotplug();  // in case all the nodes are hotpluggable
        ...
    
    numa_register_memblks()
        setup_node_data()
            memblock_find_in_range_node()
                __memblock_find_range_top_down()
                    for_each_mem_range_rev()
                        __next_mem_range_rev()
    
    This patch moves numa_clear_kernel_node_hotplug() into
    numa_register_memblks(), clear kernel node hotpluggable flag before
    alloc node data, then alloc node data won't fail even all the nodes
    are hotpluggable.
    
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: default avatarXishi Qiu <qiuxishi@huawei.com>
    Cc: Dave Jones <davej@redhat.com>
    Cc: Tang Chen <tangchen@cn.fujitsu.com>
    Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    bd5cfb89
numa.c 21.8 KB