From: Tobias Geerinckx-Rice via Guix-patches via <guix-patches@gnu.org>
To: 67733@debbugs.gnu.org
Subject: [bug#67733] [PATCH v2] daemon: Sacrifice builders on OOM.
Date: Sun, 3 Dec 2023 01:00:01 +0100 [thread overview]
Message-ID: <20231203000124.30383-1-me@tobias.gr> (raw)
In-Reply-To: <20231203000032.29995-1-me@tobias.gr>
* nix/libstore/build.cc (DerivationGoal::runChild):
Maximise our OOM score adjustment.
Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51
---
v2: Tabs tabs tabs tabs.
nix/libstore/build.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index e8259aa4e8..54555b92d7 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2154,6 +2154,12 @@ void DerivationGoal::runChild()
determinism. */
int cur = personality(0xffffffff);
if (cur != -1) personality(cur | ADDR_NO_RANDOMIZE);
+
+ /* Ask the kernel to eagerly kill us & our children if it runs out of
+ memory, regardless of blame, to preserve ‘real’ user data & state. */
+ try {
+ writeFile("/proc/self/oom_score_adj", "1000"); // 100%
+ } catch (...) { ignoreException(); }
#endif
/* Fill in the environment. */
base-commit: e796c68025aca372ff8e16eb0c235155af92f743
--
2.41.0
next prev parent reply other threads:[~2023-12-09 21:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 0:00 [bug#67733] [PATCH] daemon: Sacrifice builders on OOM Tobias Geerinckx-Rice via Guix-patches via
2023-12-03 0:00 ` Tobias Geerinckx-Rice via Guix-patches via [this message]
2023-12-03 0:00 ` [bug#67733] [PATCH v3] " Tobias Geerinckx-Rice via Guix-patches via
2023-12-10 21:51 ` Ludovic Courtès
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=20231203000124.30383-1-me@tobias.gr \
--to=guix-patches@gnu.org \
--cc=67733@debbugs.gnu.org \
--cc=me@tobias.gr \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.