Matthew Wilcox writes:
On Thu, Mar 12, 2020 at 12:48:22PM +0000, Ivan Teterevkov wrote:
This is exactly what I'm trying to avoid: in some distros there is no way
to tackle the configuration early enough, e.g. in systemd-based systems
the systemd is the process that starts first and arranges memcg in a way
it's configured, but unfortunately, it doesn't offer the swappiness knob.
This sounds like a systemd problem. Have you talked to the systemd
people about fixing it in systemd?
Hi there ;-)
In general most of us maintaining cgroups in systemd run with cgroup v2, so
this isn't a problem we run into in production. The swappiness controls in
general don't make a whole lot of sense being distributed hierarchically, so
they've been phased out entirely in cgroup v2.
If there had been a patch years ago implementing this in systemd we'd probably
have accepted it, but cgroup v1 is dying and I am really not in favour of
adding more code to massage its rough edges. We already have enough problems
generated by it already.
However, the following kludge in tmpfiles.d should work to solve your immediate
problem:
w /sys/fs/cgroup/memory/system.slice/memory.swappiness - - - - value
Taking my systemd hat off and putting my -mm hat on: let's not add more hacky
APIs at cgroup v1's behest, or we'll be here until we're pushing up the
daisies.
Thanks,
Chris