public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Rui Ueyama <rui314@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Wislist for Linux from the mold linker's POV
Date: Thu, 28 Nov 2024 18:41:14 +0100	[thread overview]
Message-ID: <87ttbrs1c5.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <CACKH++baPUaoQQhL0+qcc_DzX7kGcmAOizgfaCQ8gG=oBKDDYw@mail.gmail.com> (Rui Ueyama's message of "Thu, 28 Nov 2024 11:52:35 +0900")

* Rui Ueyama:

> - exit(2) takes a few hundred milliseconds for a large process
>
> I believe this is because mold mmaps all input files and an output
> file, and clearing/flushing memory-mapped data is fairly expensive. I
> wondered if this could be improved. If it is unavoidable, could the
> cleanup process be made asynchronous so that exit(2) takes effect
> immediately?

It's definitely a two-edged sword.  For example, when running parallel
make (or Ninja), it's essential that process exit is only signaled
after all process-related resources have been released.  Otherwise,
it's possible to see spurious failures because make respawns processes
so quickly that some resource limit is exceeded.  This is already a
problem today, and more lazy resource deallocation on exit would make
it more prevalent.

The situation is already bad enough that many developers have resorted
to retry loops around fork/clone/pthread_create if an EAGAIN error is
encountered, assuming  that it's related to this.

  Bug 154011 - Task exit is signaled before task resource
  deallocation, leading to bogus EAGAIN errors
  <https://bugzilla.kernel.org/show_bug.cgi?id=154011>

> - Writing to a fresh file is slower than writing to an existing file
>
> mold can link a 4 GiB LLVM/clang executable in ~1.8 seconds on my
> machine if the linker reuses an existing file and overwrites it.
> However, the speed decreases to ~2.8 seconds if the output file does
> not exist and mold needs to create a fresh file. I tried using
> fallocate(2) to preallocate disk blocks, but it didn't help. While 4
> GiB is not small, should creating a file really take almost a second?

Which file system is that?

> - Lack of a safe system-wide semaphore

Other toolchain components use the make jobserver protocol for that.

  reply	other threads:[~2024-11-28 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28  2:52 Wislist for Linux from the mold linker's POV Rui Ueyama
2024-11-28 17:41 ` Florian Weimer [this message]
2024-11-29  0:44   ` Rui Ueyama
2024-11-29  5:38     ` Niklas Hambüchen
2024-11-29 18:12       ` Theodore Ts'o
2024-11-30 15:36         ` Niklas Hambüchen
2024-11-29  7:17 ` наб
2024-11-29  7:25   ` Rui Ueyama
2024-11-29  7:37     ` наб
2024-12-04 10:42 ` Bernd Petrovitsch
2024-12-04 10:43 ` Bernd Petrovitsch

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=87ttbrs1c5.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui314@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