Gentoo Archives: gentoo-user

From: Adam Carter <adamcarter3@×××××.com>
To: Gentoo User <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Machine hangs up with out of memory
Date: Sun, 02 May 2021 00:39:29
Message-Id: CAC=wYCF=EBmoLnpupVBOFSEaqD=nvhF2jeny-WTAJCLAHxOcDw@mail.gmail.com
In Reply to: Re: [gentoo-user] Machine hangs up with out of memory by Michael
1 On Fri, Apr 30, 2021 at 8:09 PM Michael <confabulate@××××××××.com> wrote:
2
3 > On Friday, 30 April 2021 02:30:51 BST Adam Carter wrote:
4 > > On Wed, Apr 28, 2021 at 7:58 PM Kai Peter <kp@×××××××××××.org> wrote:
5 > > > Hi,
6 > > >
7 > > > I have an issue with a machine where I'm not able to detect the real
8 > > > root cause. It hangs up totally. It seems like it was running out of
9 > > > memory - but why? Hopefully somebody can give me some insight. As far I
10 > > > can see right now, it hangs up a few hours after an `emerge --update
11 > > > --newuse --deep --with-bdeps=y @world`.
12 > > >
13 > > > The machine is an Intel Atom with 8 GB RAM (physical, max) and 24 GB
14 > > > swap (a file). So 32 GB RAM in total.
15 > >
16 > > Might be worth adding zswap using zstd or lz4 to your config (uses more
17 > CPU
18 > > for less IO)
19 > > https://www.kernel.org/doc/html/latest/vm/zswap.html
20 >
21 > Zswap will help optimise the swapping of cold pages out of RAM into the
22 > compressed zswap cache and eventually push these out to the disk. This
23 > won't
24 > help with the problem of not having enough RAM to start with for compiling
25 > packages with large resource requirements, like e.g. Chromium.
26 >
27
28 Yep, but the system is already at its full RAM, so we're in
29 workaround/tactical solution territory. Any system that needs 24gig swap to
30 support 8gig ram is going to really suck.
31
32 >
33 > With monster packages where more RAM is needed even for a single
34 > compilation
35 > job, after all cold pages have been swapped out, hot pages will start
36 > being
37 > swapped out/in. I think at this point the same I/O race condition will
38 > ensue
39 > as if no zswap were available, plus a compress/decompress CPU load. I
40 > guess
41 > the point of starting to thrash the on-disk swap trying to free RAM may
42 > start
43 > sooner, since RAM which would otherwise be available for the single
44 > prioritised compilation job is now being used by zswap. So, there would
45 > be a
46 > sweet spot in using zswap to improve I/O performance, but it could end up
47 > becoming a disbenefit on compilation of RAM hungry packages.
48 >
49 > Please correct my reasoning above if I have misunderstood how zswap works.
50 >
51
52 What you've said sounds reasonable to me.