public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Andreas Fink <finkandreas@web.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Controlling emerges
Date: Tue, 19 Sep 2023 11:37:00 +0200	[thread overview]
Message-ID: <20230919113700.2678c8b8@anfink-laptop> (raw)
In-Reply-To: <a126d61d-7e92-ba67-3c54-5ce0d945864d@iinet.net.au>

On Tue, 19 Sep 2023 17:14:42 +0800
William Kenworthy <billk@iinet.net.au> wrote:

> That is where you set per package compiler parameters by overriding
> make.conf settings.
>
> BillK
>
>
I would argue, that per package compiler parameters is not what is
needed, because in the example of chromium 99% of the compile time can
be done with -j16 on my machine, but at a very short time I would need
to run with -j1, because I otherwise run out of memory otherwise.
In short: I want to run with as many jobs as I have cores, as long as
I do not run out of memory, and when I run out of memory I want to run
with as little jobs as possible until the pressure on the memory is
gone. Then I want to continue with as many jobs as possible.

And this is not something that make / ninja provide. They have a
concept of global number of jobs, which in this concept must be set to
the maximum number that your RAM can take at the very short period in
time where you have a high watermark on your RAM, but that number would
be at 99% of the compilation time way too low.

FWIW, I have a hacky solution that I use privately, but I never
published it anywhere, because it could break some builds, and at the
moment I'm not ready to support it.

Basically it tries to run with as many jobs as the number of CPU cores
at all times. It watches memory pressure in the background and
kills build jobs as soon as a high watermark is reached.
At this point, make would normally exit, because a build job failed.
However my hacky solution overrides the exec-family of system calls,
and if a job fails, it is being retried exclusively, i.e. no other
build job is allowed to run at the same time as the failed job.
It fails ultimately, when the second and exclusive run fails too.
This way, if the job failed only because of lack of memory, it will be
retried exclusively and succeeds. If it failed due to a programming
error, it will fail also the second time, and then the error is
forwarded to make.



  reply	other threads:[~2023-09-19  9:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 12:00 [gentoo-user] Controlling emerges Peter Humphrey
2023-09-18 12:59 ` Jack
2023-09-18 13:44   ` Peter Humphrey
2023-09-18 13:48     ` Alan McKinnon
2023-09-18 16:03       ` Peter Humphrey
2023-09-18 16:13         ` Alan McKinnon
2023-09-18 17:54           ` Laurence Perkins
2023-09-18 22:44             ` William Kenworthy
2023-09-19  9:09               ` Peter Humphrey
2023-09-19  9:14                 ` William Kenworthy
2023-09-19  9:37                   ` Andreas Fink [this message]
2023-09-19  9:48                   ` Peter Humphrey
2023-09-19 10:06                     ` Rich Freeman
2023-09-19 10:13                     ` William KENWORTHY
2023-09-18 17:59           ` Michael
2023-09-18 18:10           ` John Blinka
2023-09-18 18:18           ` Dale
2023-09-18 18:49           ` Rich Freeman
2023-09-19 12:28           ` Peter Humphrey
2023-09-20 22:06           ` Wol
2023-09-21 19:26             ` Laurence Perkins
2023-09-21 20:30               ` Tsukasa Mcp_Reznor
2023-09-22  1:13                 ` Dale
2023-09-22  7:13                   ` Michael
2023-09-22 10:07                   ` Rich Freeman

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=20230919113700.2678c8b8@anfink-laptop \
    --to=finkandreas@web.de \
    --cc=gentoo-user@lists.gentoo.org \
    /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