public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org,  goldstein.w.n@gmail.com
Subject: Re: [PATCH 0/4] elf: Use mmap to map in section contents
Date: Wed, 06 Mar 2024 04:45:55 +0000	[thread overview]
Message-ID: <87jzmg0xz0.fsf@gentoo.org> (raw)
In-Reply-To: <20240305170057.292800-1-hjl.tools@gmail.com> (H. J. Lu's message of "Tue, 5 Mar 2024 09:00:53 -0800")

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

"H.J. Lu" <hjl.tools@gmail.com> writes:

> 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".

Thanks for working on this. I've suffered from OOMs when linking large
C++ projects with debug info a lot. I'm going to include it in my
regular test builds.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 377 bytes --]

      parent reply	other threads:[~2024-03-06  4:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzmg0xz0.fsf@gentoo.org \
    --to=sam@gentoo.org \
    --cc=binutils@sourceware.org \
    --cc=goldstein.w.n@gmail.com \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).