• Jiang Liu's avatar
    vmlinux.lds: add comments for global variables and clean up useless declarations · 1622d1ab
    Jiang Liu authored
    The original goal of this patchset is to fix the bug reported by
    https://bugzilla.kernel.org/show_bug.cgi?id=53501 Now it has also been
    expanded to reduce common code used by memory initializion.
    Patch 1-7:
    	1) add comments for global variables exported by vmlinux.lds
    	2) normalize global variables exported by vmlinux.lds
    Patch 8:
    	Introduce helper functions mem_init_print_info() and
    Patch 9:
    	Avoid using global variable num_physpages at runtime
    Patch 10:
    	Don't update num_physpages in memory_hotplug.c
    Patch 11-40:
    	Modify arch mm initialization code to:
    	1) Simplify mem_init() by using mem_init_print_info()
    	2) Prepare for killing global variable num_physpages
    Patch 41:
    	Kill the global variable num_physpages
    With all patches applied, mem_init(), free_initmem(), free_initrd_mem()
    could be as simple as below.  This patch series has reduced about 1.2K
    lines of code in total.
    void __init
    	max_mapnr = max_low_pfn;
    	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
    #endif /* CONFIG_DISCONTIGMEM */
    free_initrd_mem(unsigned long start, unsigned long end)
    	free_reserved_area(start, end, -1, "initrd");
    Due to hardware resource limitations, I have only tested this on x86_64.
    And the messages reported on an x86_64 system are:
    Log message before applying patches:
    Memory: 7745676k/8910848k available (6934k kernel code, 836024k absent, 329148k reserved, 6343k data, 1012k init)
    Log message after applying patches:
    Memory: 7744624K/8074824K available (6969K kernel code, 1011K data, 2828K rodata, 1016K init, 9640K bss, 330200K reserved)
    Great thanks to Vineet Gupta for testing on ARC.
    This patch:
    Document global variables exported from vmlinux.lds.
    1) Add comments about usage guidelines for global variables exported
       from vmlinux.lds.S.
    2) Remove unused __initdata_begin[] and __initdata_end[].
    Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
    Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Vineet Gupta <vgupta@synopsys.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
sections.h 2.04 KB