• HATAYAMA Daisuke's avatar
    vmcore: allocate ELF note segment in the 2nd kernel vmalloc memory · 087350c9
    HATAYAMA Daisuke authored
    The reasons why we don't allocate ELF note segment in the 1st kernel
    (old memory) on page boundary is to keep backward compatibility for old
    kernels, and that if doing so, we waste not a little memory due to
    round-up operation to fit the memory to page boundary since most of the
    buffers are in per-cpu area.
    
    ELF notes are per-cpu, so total size of ELF note segments depends on
    number of CPUs.  The current maximum number of CPUs on x86_64 is 5192,
    and there's already system with 4192 CPUs in SGI, where total size
    amounts to 1MB.  This can be larger in the near future or possibly even
    now on another architecture that has larger size of note per a single
    cpu.  Thus, to avoid the case where memory allocation for large block
    fails, we allocate vmcore objects on vmalloc memory.
    
    This patch adds elfnotes_buf and elfnotes_sz variables to keep pointer
    to the ELF note segment buffer and its size.  There's no longer the
    vmcore object that corresponds to the ELF note segment in vmcore_list.
    Accordingly, read_vmcore() has new case for ELF note segment and
    set_vmcore_list_offsets_elf{64,32}() and other helper functions starts
    calculating offset from sum of size of ELF headers and size of ELF note
    segment.
    
    [akpm@linux-foundation.org: use min(), fix error-path vzalloc() leaks]
    Signed-off-by: default avatarHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
    Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
    Cc: Lisa Mitchell <lisa.mitchell@hp.com>
    Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    087350c9
vmcore.c 22.5 KB