Gentoo Archives: gentoo-user

From: Kai Krakow <hurikhan77@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Something eats my memory - please help
Date: Sun, 09 Apr 2017 02:16:04
Message-Id: 20170409041533.6c634a5e@jupiter.sol.kaishome.de
In Reply to: [gentoo-user] Something eats my memory - please help by Helmut Jarausch
1 Am Sat, 08 Apr 2017 21:33:20 +0200
2 schrieb Helmut Jarausch <jarausch@××××××.be>:
3
4 > Hi,
5 >
6 > since a few days my system eats up memory, uses SWAP space and gets
7 > slow.
8 > It might depend on xorg-server, but I don't know why.
9 >
10 > On a nearly idle system (except xorg-server and some XTerms) I have
11 > MEM | tot 7.5G | free 2.9G | cache 1.2G | buff 114.6M
12 > | slab 498.0M | shmem 848.3M | vmbal 0.0M | hptot 0.0M
13 >
14 > (My system has 8G memory installed)
15 >
16 > Adding up all terms except 'tot' I get 5.6G where are the remaining
17 > 2G? And why is shmem 0.85G - I have even seen a value of 4G for
18 > shmem although all tempfs filesystems
19 > were nearly empty.
20 >
21 > When I stop the X-server I get
22 >
23 > MEM | tot 7.5G | free 6.9G | cache 387.4M | buff 118.4M
24 > | slab 72.0M | shmem 1.4M | vmbal 0.0M | hptot 0.0M |
25 >
26 >
27 > I haven't seen this in the last 10 years!
28 >
29 > I'm running kernel 4.11.0-rc5 but I doubt it has to do with the
30 > kernel since the values without a running xorg-server are for the
31 > same kernel.
32 >
33 > Has anybody seen something similar?
34
35 It would be interesting to see the memory usage of the running
36 processes. Start top and press Shift+M (and maybe press "c" also to
37 see the complete command line) and watch the memory usage. When you
38 start experiencing slowdowns, have a look at top again.
39
40 For me, it was a runaway upower process some months ago. I'm using
41 systemd, so I fixed it easily with the following drop-in:
42
43 $ cat /etc/systemd/system/upower.service.d/99memory.conf
44 [Service]
45 MemoryLimit=512M
46
47 Upower now is limited to 512M of RAM (tho, it can still occupy swap
48 instead). That means, due to the resource limit RAM no longer filled up
49 but swap did. But that was meaningless performance-wise (I have 16G RAM
50 and 64G swap).
51
52 Maybe you can also "fix" it in a similar way by jailing misbehaving
53 processes into a limited amount of RAM with cgroups. Swap will still be
54 used but not for running/interactive processes so it won't become slow.
55
56 Strange enough: The moment I did this, the process stopped misbehaving.
57
58 Cgroups also support controlling swap usage but it comes at the cost of
59 additional memory usage (and probably also performance overhead), so I
60 only activated the RAM controller. And I started to add some safety
61 limits to other services, too. They now also dump their
62 never-needed-again junk straight into swap if any memory allocation
63 bugs would hit me.
64
65 --
66 Regards,
67 Kai
68
69 Replies to list-only preferred.

Replies

Subject Author
Re: [gentoo-user] Re: Something eats my memory - please help David Haller <gentoo@×××××××.de>