Am Sat, 08 Apr 2017 21:33:20 +0200
schrieb Helmut Jarausch <jarau...@skynet.be>:

> Hi,
> 
> since a few days my system eats up memory, uses SWAP space and gets  
> slow.
> It might depend on xorg-server, but I don't know why.
> 
> On a nearly idle system (except xorg-server and some XTerms) I have
>   MEM | tot     7.5G  | free    2.9G  | cache   1.2G  | buff  114.6M
> | slab  498.0M |  shmem 848.3M |  vmbal   0.0M |  hptot   0.0M
> 
> (My system has 8G memory installed)
> 
> Adding up all terms except 'tot' I get 5.6G where are the remaining
> 2G? And why is  shmem 0.85G - I have even seen a value of 4G for
> shmem although all tempfs filesystems
> were nearly empty.
> 
> When I stop the X-server I get
> 
> MEM |  tot     7.5G |  free    6.9G  | cache 387.4M  |  buff  118.4M
> | slab   72.0M  |  shmem   1.4M |  vmbal   0.0M  | hptot   0.0M  |
> 
> 
> I haven't seen this in the last 10 years!
> 
> I'm running kernel 4.11.0-rc5 but I doubt it has to do with the
> kernel since the values without a running  xorg-server  are for the
> same kernel.
> 
> Has anybody seen something similar?

It would be interesting to see the memory usage of the running
processes. Start top and press Shift+M (and maybe press "c" also to
see the complete command line) and watch the memory usage. When you
start experiencing slowdowns, have a look at top again.

For me, it was a runaway upower process some months ago. I'm using
systemd, so I fixed it easily with the following drop-in:

$ cat /etc/systemd/system/upower.service.d/99memory.conf
[Service]
MemoryLimit=512M

Upower now is limited to 512M of RAM (tho, it can still occupy swap
instead). That means, due to the resource limit RAM no longer filled up
but swap did. But that was meaningless performance-wise (I have 16G RAM
and 64G swap).

Maybe you can also "fix" it in a similar way by jailing misbehaving
processes into a limited amount of RAM with cgroups. Swap will still be
used but not for running/interactive processes so it won't become slow.

Strange enough: The moment I did this, the process stopped misbehaving.

Cgroups also support controlling swap usage but it comes at the cost of
additional memory usage (and probably also performance overhead), so I
only activated the RAM controller. And I started to add some safety
limits to other services, too. They now also dump their
never-needed-again junk straight into swap if any memory allocation
bugs would hit me.

-- 
Regards,
Kai

Replies to list-only preferred.


Reply via email to