• Alexander van Heukelum's avatar
    Solve section mismatch for free_area_init_core. · b5a0e011
    Alexander van Heukelum authored
    WARNING: vmlinux.o(.meminit.text+0x649):
    Section mismatch in reference from the
    function free_area_init_core() to the function .init.text:setup_usemap()
    The function __meminit free_area_init_core() references
    a function __init setup_usemap().
    If free_area_init_core is only used by setup_usemap then
    annotate free_area_init_core with a matching annotation.
    
    The warning is covers this stack of functions in mm/page_alloc.c:
    
    alloc_bootmem_node must be marked __init.
    alloc_bootmem_node is used by setup_usemap, if !SPARSEMEM.
    (usemap_size is only used by setup_usemap, if !SPARSEMEM.)
    setup_usemap is only used by free_area_init_core.
    free_area_init_core is only used by free_area_init_node.
    
    free_area_init_node is used by:
    arch/alpha/mm/numa.c: __init paging_init()
    arch/arm/mm/init.c: __init bootmem_init_node()
    arch/avr32/mm/init.c: __init paging_init()
    arch/cris/arch-v10/mm/init.c: __init paging_init()
    arch/cris/arch-v32/mm/init.c: __init paging_init()
    arch/m32r/mm/discontig.c: __init zone_sizes_init()
    arch/m32r/mm/init.c: __init zone_sizes_init()
    arch/m68k/mm/motorola.c: __init paging_init()
    arch/m68k/mm/sun3mmu.c: __init paging_init()
    arch/mips/sgi-ip27/ip27-memory.c: __init paging_init()
    arch/parisc/mm/init.c: __init paging_init()
    arch/sparc/mm/srmmu.c: __init srmmu_paging_init()
    arch/sparc/mm/sun4c.c: __init sun4c_paging_init()
    arch/sparc64/mm/init.c: __init paging_init()
    mm/page_alloc.c: __init free_area_init_nodes()
    mm/page_alloc.c: __init free_area_init()
    and
    mm/memory_hotplug.c: hotadd_new_pgdat()
    
    hotadd_new_pgdat can not be an __init function, but:
    
    It is compiled for MEMORY_HOTPLUG configurations only
    MEMORY_HOTPLUG depends on SPARSEMEM || X86_64_ACPI_NUMA
    X86_64_ACPI_NUMA depends on X86_64
    ARCH_FLATMEM_ENABLE depends on X86_32
    ARCH_DISCONTIGMEM_ENABLE depends on X86_32
    So X86_64_ACPI_NUMA implies SPARSEMEM, right?
    
    So we can mark the stack of functions __init for !SPARSEMEM, but we must mark
    them __meminit for SPARSEMEM configurations.  This is ok, because then the
    calls to alloc_bootmem_node are also avoided.
    
    Compile-tested on:
    silly minimal config
    defconfig x86_32
    defconfig x86_64
    defconfig x86_64 -HIBERNATION +MEMORY_HOTPLUG
    Signed-off-by: default avatarAlexander van Heukelum <heukelum@fastmail.fm>
    Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
    Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    b5a0e011
internal.h 1.61 KB