• Oleg Nesterov's avatar
    coredump: kill call_count, add core_name_size · 3ceadcf6
    Oleg Nesterov authored
    
    
    Imho, "atomic_t call_count" is ugly and should die.  It buys nothing and
    in fact it can grow more than necessary, expand doesn't check if it was
    already incremented by another task.
    
    Kill it, and introduce "static int core_name_size" updated by
    expand_corename().  This is obviously racy too but harmless, and
    core_name_size never grows for no reason.
    
    We do not bother to to calculate the "right" new size, we simply do
    kmalloc(size_we_need) and use ksize() to rely on kmalloc_index's decision.
    
    Finally change format_corename() to use expand_corename(), krealloc(NULL)
    is fine.
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Colin Walters <walters@verbum.org>
    Cc: Denys Vlasenko <vda.linux@googlemail.com>
    Cc: Jiri Slaby <jslaby@suse.cz>
    Cc: Lennart Poettering <mzxreary@0pointer.de>
    Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
    Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3ceadcf6
coredump.c 17.4 KB