Skip to content

objtool: Reduce memory usage with CONFIG_DEBUG_INFO

Josh Poimboeuf lkml 1 version Applied

Status from this message: The following commit has been merged into the objtool/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest22 patches 0 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/22objtool: Tidy elf.htools/objtool/include/objtool/elf.h+47 -490 replies
2/22objtool: Remove flags argument from elf_create_section()tools/objtool/check.c tools/objtool/elf.c tools/objtool/include/objtool/elf.h +1 more+18 -150 replies
3/22objtool: Improve reloc namingtools/objtool/check.c tools/objtool/elf.c tools/objtool/include/objtool/elf.h+151 -1490 replies
4/22objtool: Consolidate rel/rela handlingtools/objtool/check.c tools/objtool/elf.c tools/objtool/include/objtool/elf.h+68 -1590 replies
5/22objtool: Fix reloc_hash sizetools/objtool/elf.c tools/objtool/include/objtool/elf.h+14 -100 replies
6/22objtool: Add mark_sec_changed()tools/objtool/elf.c tools/objtool/include/objtool/elf.h+29 -160 replies
7/22objtool: Add elf_create_section_pair()tools/objtool/arch/powerpc/include/arch/elf.h tools/objtool/arch/x86/include/arch/elf.h tools/objtool/check.c +3 more+184 -1570 replies
8/22objtool: Keep GElf_Rel[a] structs syncedtools/objtool/elf.c+14 -410 replies
9/22objtool: Don't free memory in elf_close()tools/objtool/elf.c+4 -200 replies
10/22objtool: Add for_each_reloc()tools/objtool/check.c tools/objtool/include/objtool/elf.h+18 -120 replies
11/22objtool: Allocate relocs in advance for new rela sectionstools/objtool/elf.c+13 -50 replies
12/22objtool: Get rid of reloc->listtools/objtool/elf.c tools/objtool/include/objtool/elf.h+26 -240 replies
13/22objtool: Get rid of reloc->idxtools/objtool/elf.c tools/objtool/include/objtool/elf.h+9 -70 replies
14/22objtool: Get rid of reloc->offsettools/objtool/check.c tools/objtool/elf.c tools/objtool/include/objtool/elf.h+18 -140 replies
15/22objtool: Get rid of reloc->typetools/objtool/arch/x86/decode.c tools/objtool/arch/x86/special.c tools/objtool/check.c +2 more+21 -130 replies
16/22objtool: Get rid of reloc->addendtools/objtool/arch/x86/decode.c tools/objtool/arch/x86/special.c tools/objtool/check.c +3 more+53 -420 replies
17/22objtool: Get rid of reloc->jump_table_starttools/objtool/check.c tools/objtool/include/objtool/elf.h+23 -130 replies
18/22objtool: Shrink reloc->sym_reloc_entrytools/objtool/elf.c tools/objtool/include/objtool/elf.h+7 -60 replies
19/22objtool: Shrink elf hash nodestools/objtool/elf.c tools/objtool/include/objtool/elf.h+58 -180 replies
20/22objtool: Get rid of reloc->rel[a]tools/objtool/check.c tools/objtool/elf.c tools/objtool/include/objtool/elf.h+96 -780 replies
21/22objtool: Free insns when donetools/objtool/check.c+30 -00 replies
22/22objtool: Skip reading DWARF section datatools/objtool/elf.c+6 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/22] objtool: Reduce memory usage with CONFIG_DEBUG_INFO

DWARF uses a LOT of relocations, causing objtool to need a LOT of memory for processing vmlinux.o.

In the worst case of an allyesconfig+CONFIG_DEBUG_INFO kernel, DWARF creates almost 200 million relocations, ballooning objtool's peak heap usage to 53GB. These patches reduce that to 25GB.

On a distro-type kernel with kernel IBT enabled, they reduce objtool's peak heap usage from 4.2GB to 2.8GB.

They also improve the runtime significantly (from 2m50s to 1m54s on my system with allyesconfig+CONFIG_DEBUG_INFO), though most of that comes from fixing the size calculation for reloc_hash.

Josh Poimboeuf (22):
objtool: Tidy elf.h
objtool: Remove flags argument from elf_create_section()
objtool: Improve reloc naming
objtool: Consolidate rel/rela handling
objtool: Fix reloc_hash size
objtool: Add mark_sec_changed()
objtool: Add elf_create_section_pair()
objtool: Keep GElf_Rel[a] structs synced
objtool: Don't free memory in elf_close()
objtool: Add for_each_reloc()
objtool: Allocate relocs in advance for new rela sections
objtool: Get rid of reloc->list
objtool: Get rid of reloc->idx
objtool: Get rid of reloc->offset
objtool: Get rid of reloc->type
objtool: Get rid of reloc->addend
objtool: Get rid of reloc->jump_table_start
objtool: Shrink reloc->sym_reloc_entry
objtool: Shrink elf hash nodes
objtool: Get rid of reloc->rel[a]
objtool: Free insns when done
objtool: Skip reading DWARF section data

 tools/objtool/arch/powerpc/include/arch/elf.h |  11 +-
 tools/objtool/arch/x86/decode.c               |   6 +-
 tools/objtool/arch/x86/include/arch/elf.h     |  11 +-
 tools/objtool/arch/x86/special.c              |   6 +-
 tools/objtool/check.c                         | 429 +++++++-------
 tools/objtool/elf.c                           | 537 +++++++-----------
 tools/objtool/include/objtool/elf.h           | 326 ++++++++---
 tools/objtool/orc_gen.c                       |   8 +-
 tools/objtool/special.c                       |   4 +-
 9 files changed, 698 insertions(+), 640 deletions(-)
Signature · 1 line
2.40.1