Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: webrsync {SOLVED}
Date: Sat, 29 Feb 2020 16:07:22
Message-Id: 6a39a434-6e9c-4d45-d748-ba2dab061043@gmail.com
In Reply to: Re: [gentoo-user] Re: webrsync {SOLVED} by Rich Freeman
1 Rich Freeman wrote:
2 > On Sat, Feb 29, 2020 at 9:49 AM Dale <rdalek1967@×××××.com> wrote:
3 >> I have noticed the OOM killing the wrong thing as well. In a way, how
4 >> does it know what it should kill really??? After all, the process using
5 >> the most memory may not be the problem but another one, or more, could.
6 >> I guess in most cases the one using the most is the bad one but it may
7 >> not always be the case. I'm not sure how OOM could determine that tho.
8 >> Maybe having some setting like you mentions would help. It's a thought.
9 > Oh, plenty of people have given thought to it.
10 >
11 > The algorithm is actually not as well-documented as I thought it was.
12 > Lots of documents, but they're fragmented. Behavior is also
13 > configurable. For example, you can just tell Linux to panic on OOM,
14 > or just have it kill the process that triggered OOM even if it isn't
15 > using much memory.
16 >
17 > Best docs I could find are at (among other places):
18 > https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.txt#L1520
19 >
20 > Aside from setting limits on services so that they die/restart before
21 > overall system memory is threatened, adjusting oom_score_adj lets you
22 > tweak overall priorities for any process.
23 >
24 > By default it mostly comes down to what process is hogging the most
25 > RAM, with slight preference for root-owned processes.
26 >
27 > Really though setting resource limits is your best bet. Then you can
28 > set a threshold above normal use, and if something misbehaves it is
29 > going to get restarted before most of RAM is taken. User session
30 > cgroups can of course be limited as well so that interactive processes
31 > can't just go nuts and use all your RAM.
32 >
33
34
35 Let's use my recent issue for example.  Firefox going into memory eating
36 like a starving sumo wrestler.  Is there a way to limit Firefox itself? 
37 Set it to like 5GBs and when it hits that, it does a graceful exit, then
38 a kill if that doesn't work?  The reason I ask, I don't recall having a
39 service ever eat memory but I'm sure some do.  Firefox has been my
40 biggest problem.  It still on occasion gets up around 3 or 4GBs.  I
41 recompiled with different USE flags and that seems to help but still,
42 rather than crash my system or just hope that OOM will get it right, I'd
43 rather have it pick on what I know to be the biggest offender in my
44 case.  That same info could be used by someone else just with a
45 different process being set to limit memory use.  In other words,
46 examples of the settings if possible???
47
48 Now to go read that link more thoroughly.  ;-)
49
50 Dale
51
52 :-)  :-)