mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
daemon: Sacrifice builders on OOM.
* nix/libstore/build.cc (DerivationGoal::runChild): Maximise our OOM score adjustment. Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51
This commit is contained in:
parent
38035705ed
commit
d993ed43b2
1 changed files with 6 additions and 0 deletions
|
@ -2154,6 +2154,12 @@ void DerivationGoal::runChild()
|
||||||
determinism. */
|
determinism. */
|
||||||
int cur = personality(0xffffffff);
|
int cur = personality(0xffffffff);
|
||||||
if (cur != -1) personality(cur | ADDR_NO_RANDOMIZE);
|
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
|
#endif
|
||||||
|
|
||||||
/* Fill in the environment. */
|
/* Fill in the environment. */
|
||||||
|
|
Loading…
Reference in a new issue