public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/22] objtool: Reduce memory usage with CONFIG_DEBUG_INFO
@ 2023-05-30 17:20 Josh Poimboeuf
  2023-05-30 17:20 ` [PATCH 01/22] objtool: Tidy elf.h Josh Poimboeuf
                   ` (21 more replies)
  0 siblings, 22 replies; 45+ messages in thread
From: Josh Poimboeuf @ 2023-05-30 17:20 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Peter Zijlstra, Miroslav Benes

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(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2023-06-09  7:50 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-30 17:20 [PATCH 00/22] objtool: Reduce memory usage with CONFIG_DEBUG_INFO Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 01/22] objtool: Tidy elf.h Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 02/22] objtool: Remove flags argument from elf_create_section() Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 03/22] objtool: Improve reloc naming Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 04/22] objtool: Consolidate rel/rela handling Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 05/22] objtool: Fix reloc_hash size Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 06/22] objtool: Add mark_sec_changed() Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:20 ` [PATCH 07/22] objtool: Add elf_create_section_pair() Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 08/22] objtool: Keep GElf_Rel[a] structs synced Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 09/22] objtool: Don't free memory in elf_close() Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 10/22] objtool: Add for_each_reloc() Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 11/22] objtool: Allocate relocs in advance for new rela sections Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 12/22] objtool: Get rid of reloc->list Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 13/22] objtool: Get rid of reloc->idx Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 14/22] objtool: Get rid of reloc->offset Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 15/22] objtool: Get rid of reloc->type Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 16/22] objtool: Get rid of reloc->addend Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 17/22] objtool: Get rid of reloc->jump_table_start Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 18/22] objtool: Shrink reloc->sym_reloc_entry Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 19/22] objtool: Shrink elf hash nodes Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 20/22] objtool: Get rid of reloc->rel[a] Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 21/22] objtool: Free insns when done Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf
2023-05-30 17:21 ` [PATCH 22/22] objtool: Skip reading DWARF section data Josh Poimboeuf
2023-06-09  7:47   ` [tip: objtool/core] " tip-bot2 for Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox