-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday, 2018-10-15 at 14:54 +0200, Per Jessen wrote:
Carlos E. R. wrote:
I'm trying to force the clamd process to swap agresively, because by
default it eats 500 MB of my limited memory even when it is doing
nothing but waiting.
Be aware this will increase email processing time, otherwise it ought to
work fine.
That's fine. Swapping out is not immediate, so if there is a continuous flow
of mails it should not swap. A delay of a fraction of a second when sending
a single email is not important.
Apparently this is done with cgroups, about which I know close to
nothing.
Search the list for an example in the last couple of weeks. I can't
remember who it was, but one process was gobbling up too much memory,
rendering the entire system unworkable. The issue was solved by
setting a memory limit using cgroups.
Limiting memory would probably make the process to crash, I suppose.
Probably this one:
Date: Wed, 19 Sep 2018 12:21:11 +0100
From: Peter Suetterlin <>
To: "opensuse@opensuse.org"
Subject: Re: [opensuse] swap performance
...
I even participated on that thread, then I forgot.
He does:
sudo mkdir /sys/fs/cgroup/memory/notover4g
echo 4294967296 | sudo tee /sys/fs/cgroup/memory/notover4g/memory.limit_in_bytes > /dev/null
echo "$$" | sudo tee /sys/fs/cgroup/memory/notover4g/cgroup.procs > /dev/null
Ah! So creating the directory is the trick!
Telcontar:/sys/fs/cgroup/memory # ls clamd/
cgroup.clone_children cgroup.procs memory.force_empty memory.low_limit_in_bytes memory.move_charge_at_immigrate memory.oom_control memory.soft_limit_in_bytes memory.swappiness memory.use_hierarchy tasks
cgroup.event_control memory.failcnt memory.limit_in_bytes memory.max_usage_in_bytes memory.numa_stat memory.pressure_level memory.stat memory.usage_in_bytes notify_on_release
Telcontar:/sys/fs/cgroup/memory #
Telcontar:/sys/fs/cgroup/memory # cd clamd/
Telcontar:/sys/fs/cgroup/memory/clamd # ls
cgroup.clone_children cgroup.procs memory.force_empty memory.low_limit_in_bytes memory.move_charge_at_immigrate memory.oom_control memory.soft_limit_in_bytes memory.swappiness memory.use_hierarchy tasks
cgroup.event_control memory.failcnt memory.limit_in_bytes memory.max_usage_in_bytes memory.numa_stat memory.pressure_level memory.stat memory.usage_in_bytes notify_on_release
Telcontar:/sys/fs/cgroup/memory/clamd # cat memory.swappiness
60
Telcontar:/sys/fs/cgroup/memory/clamd # echo 100 > memory.swappiness
Telcontar:/sys/fs/cgroup/memory/clamd # cat memory.swappiness
100
Telcontar:/sys/fs/cgroup/memory/clamd #
Still the process is not swapped out. I'll restart the process. [...] No, not swapped.
But at least now I know how to change swapiness of a single process, thanks! :-)
Ah! I *notice* more in the thread!
He did explain the process entirely in another post.
«Then start a process, get it's PID and
echo $PID > /sys/fs/cgroup/memory/14G/cgroup.procs»
Ok... let's see.
Telcontar:/sys/fs/cgroup/memory/clamd # echo 100 > memory.swappiness
Telcontar:/sys/fs/cgroup/memory/clamd # cat cgroup.procs
Telcontar:/sys/fs/cgroup/memory/clamd # echo 16284 > cgroup.procs
Telcontar:/sys/fs/cgroup/memory/clamd # cat cgroup.procs
16284
Telcontar:/sys/fs/cgroup/memory/clamd #
Telcontar:/sys/fs/cgroup/memory/clamd # cat tasks
16284
16285
Telcontar:/sys/fs/cgroup/memory/clamd #
But still does not swap out anything.
top - 15:36:30 up 7 days, 1:29, 1 user, load average: 0,76, 0,71, 0,72
Tasks: 531 total, 1 running, 529 sleeping, 0 stopped, 1 zombie
%Cpu(s): 12,0 us, 3,1 sy, 0,0 ni, 75,5 id, 9,3 wa, 0,0 hi, 0,1 si, 0,0 st
KiB Mem: 8174528 total, 7674028 used, 500500 free, 18516 buffers
KiB Swap: 25165820 total, 5125572 used, 20040248 free. 1780272 cached Mem
PID USER PR NI VIRT RES SHR SWAP S %CPU %MEM TIME+ COMMAND
7098 cer 20 0 4340104 1,534g 58612 388588 S 0,330 19,67 306:21.50 thunderbird-bin
7494 cer 20 0 3080508 845212 67024 255556 S 15,18 10,34 159:22.82 Web Content
5221 cer 20 0 10,116g 670840 136600 462136 S 18,48 8,206 137:51.72 firefox
7341 cer 20 0 2892228 660472 37464 202260 S 0,330 8,080 78:58.07 Web Content
16284 vscan 20 0 784860 554400 3508 0 S 0,000 6,782 0:00.01 clamd
. . . . . . . . . . . . . . . . . . . . . .*******
Limiting the memory is not what I want, because it would limit the memory
while the process is actually working and needing the memory, thus trashing.
Oct 15 14:08:49 Telcontar systemd[1]:
[/etc/systemd/system/clamd.service.d/override.conf:2] Unknown lvalue
['ControlGroupAttribute' in section 'Service'
Telcontar:~ #
What? The lvalue is copied from the documentation! How can I then do
it?
The option was removed:
https://bugzilla.redhat.com/show_bug.cgi?id=1172890
Damm! :-/
Lukáš Nykrýn 2014-12-11 01:35:42 EST
This option was removed in 208
- From 208 release notes:
* As discussed earlier, the low-level cgroup configuration
options ControlGroup=, ControlGroupModify=,
ControlGroupPersistent=, ControlGroupAttribute= have been
removed. Please use high-level attribute settings instead as
well as slice units.
And some other info
http://lwn.net/Articles/555923/
But what "high-level attribute setting"? The link does not explain.
Those entries were used when the high-level attributes do not exist - so
says the doc. Where are they listed, if the documentation is incorrect?
- --
Cheers,
Carlos E. R.
(from openSUSE 42.3 x86_64 "Malachite" at Telcontar)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iEYEARECAAYFAlvEme8ACgkQtTMYHG2NR9XG8wCeJnEGyQ79gRWjSqLA8ql0vxzD
78MAoIXsdX/G5/Mhf+w8QA6FrKELEDT9
=+TsZ
-----END PGP SIGNATURE-----