• Peter Zijlstra's avatar
    objtool: Rewrite hashtable sizing · 25cf0d8a
    Peter Zijlstra authored
    Currently objtool has 5 hashtables and sizes them 16 or 20 bits
    depending on the --vmlinux argument.
    
    However, a single side doesn't really work well for the 5 tables,
    which among them, cover 3 different uses. Also, while vmlinux is
    larger, there is still a very wide difference between a defconfig and
    allyesconfig build, which again isn't optimally covered by a single
    size.
    
    Another aspect is the cost of elf_hash_init(), which for large tables
    dominates the runtime for small input files. It turns out that all it
    does it assign NULL, something that is required when using malloc().
    However, when we allocate memory using mmap(), we're guaranteed to get
    zero filled pages.
    
    Therefore, rewrite the whole thing to:
    
     1) use more dynamic sized tables, depending on the input file,
     2) avoid the need for elf_hash_init() entirely by using mmap().
    
    This speeds up a regular kernel build (100s to 98s for
    x86_64-defconfig), and potentially dramatically speeds up vmlinux
    processing.
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20210506194157.452881700@infradead.org
    25cf0d8a
elf.c 24.5 KB