public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] elf: Use mmap to map in section contents
@ 2024-03-05 17:00 H.J. Lu
  2024-03-05 17:00 ` [PATCH 1/4] elf: Use mmap to map in read-only sections H.J. Lu
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: H.J. Lu @ 2024-03-05 17:00 UTC (permalink / raw)
  To: binutils; +Cc: goldstein.w.n

We can use mmap to map in ELF section contents, instead of copying them
into memory by hand.  We don't need to cache symbol nor relocation tables
if they are mapped in.  Data to link the 3.5GB clang executable in LLVM
17 debug build on Linux/x86-64 with 32GB RAM is:

		stdio		mmap		improvement
user		86.73		87.02		-0.3%
system		9.55		9.21		3.6%
total		100.40		97.66		0.7%
maximum set(GB)	17.34		13.14		24%
page faults	4047667		3042877		25%

and data to link the 275M cc1plus executable in GCC 14 stage 1 build is:

user		5.41		5.44		-0.5%
system		0.80		0.76		5%
total		6.25		6.26		-0.2%
maximum set(MB)	1323		968		27%
page faults	323451		236371		27%

Data shows that these won't improve the single copy linker performance.
But they improve the overall system performance when linker is used by
reducing linker memory usage and page faults.  They allow more parallel
linker jobs on LLVM debug build.

Here is a quote from Noah Goldstein: "on a large project they are an
extremely large speedup".

H.J. Lu (4):
  elf: Use mmap to map in read-only sections
  elf: Add _bfd_elf_mmap_section and _bfd_elf_munmap_section_contents
  elf: Use mmap to map in symbol and relocation tables
  elf: Don't cache symbol nor relocation tables with mmap

 bfd/bfd-in2.h      |  43 ++++++--
 bfd/bfd.c          |  17 +++
 bfd/bfdio.c        |  16 +--
 bfd/bfdwin.c       |   8 +-
 bfd/cache.c        |  11 +-
 bfd/compress.c     |   2 +-
 bfd/elf-bfd.h      |  11 ++
 bfd/elf-eh-frame.c |   4 +-
 bfd/elf-sframe.c   |   4 +-
 bfd/elf.c          | 256 +++++++++++++++++++++++++++++++++++++--------
 bfd/elf32-i386.c   |   6 +-
 bfd/elf64-x86-64.c |  10 +-
 bfd/elfcode.h      |   7 +-
 bfd/elflink.c      |  72 ++++++++-----
 bfd/elfxx-target.h |   6 +-
 bfd/elfxx-x86.c    |   7 +-
 bfd/elfxx-x86.h    |   1 +
 bfd/libbfd-in.h    |  32 ++++++
 bfd/libbfd.c       | 247 ++++++++++++++++++++++++++++++++++++++++++-
 bfd/libbfd.h       |  36 ++++++-
 bfd/linker.c       |   7 +-
 bfd/lynx-core.c    |   2 +-
 bfd/opncls.c       |  25 ++++-
 bfd/section.c      |  24 ++++-
 24 files changed, 721 insertions(+), 133 deletions(-)

-- 
2.44.0


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

end of thread, other threads:[~2024-03-06 20:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 17:00 [PATCH 0/4] elf: Use mmap to map in section contents H.J. Lu
2024-03-05 17:00 ` [PATCH 1/4] elf: Use mmap to map in read-only sections H.J. Lu
2024-03-05 17:00 ` [PATCH 2/4] elf: Add _bfd_elf_mmap_section and _bfd_elf_munmap_section_contents H.J. Lu
2024-03-05 17:00 ` [PATCH 3/4] elf: Use mmap to map in symbol and relocation tables H.J. Lu
2024-03-05 17:00 ` [PATCH 4/4] elf: Don't cache symbol nor relocation tables with mmap H.J. Lu
2024-03-05 17:03 ` [PATCH 0/4] elf: Use mmap to map in section contents Noah Goldstein
2024-03-06  0:50 ` Alan Modra
2024-03-06 16:16   ` H.J. Lu
2024-03-06 20:51     ` H.J. Lu
2024-03-06  4:45 ` Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).