[systemd-devel] system-wide MemoryMax - possible?

Lennart Poettering lennart at poettering.net
Mon Mar 18 09:59:02 UTC 2019


On Mo, 18.03.19 01:04, Tomasz Chmielewski (mangoo at wpkg.org) wrote:

> How about achieving a similar result with just systemd? Is there some
> system-wide MemoryMax which we could easily set in one place?

The top-leve cgroup doesn't expose functionality for that.

What you probably could do is create a top-level cgroup before
invoking PID 1, then set limits on that, and invoke systemd as PID 1
inside it. generally, systemd will maintain its stuff below the cgroup
it was initially started in. Usually that's the top-level cgroup, but
it should work fine if its another one.

Of course, this means systemd won't manage the top-level cgroup for
you (i.e. the one above the subtree systemd will manage), but i figure
for simpler stuff that should be fine.

> I.e. a desktop system where user opens several browsers, with too many tabs
> with too many memory-intensive pages - becomes unresponsive for long
> minutes, before OOM-killer finally kills the offender.

Quite frankly, this sounds like somehting where you want to tweak the
OOM killer, instead of making memory even scarcer...

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list