[systemd-devel] How to correctly use memory controls (MemoryLow) on unified hierarchy system?

Michal Koutný mkoutny at suse.com
Wed May 26 17:54:26 UTC 2021


On Fri, May 21, 2021 at 08:14:03PM +0300, Andrei Borzenkov <arvidjaar at gmail.com> wrote:
> That's overkill for my purposes. This is single user system and all I am
> trying to do is to prevent swapping out Wayland composer to avoid
> waiting several minutes to unblank screen. I am fine with setting values
> once.

system.slice:MemoryLow=A
foo.service :MemoryLow=B	// e.g. the compositor

A < B
- you get protection of A bytes against global reclaim
- specifically A = 0 turns protection off

A > B
- you get protection of >=B bytes against global reclaim for foo.service
- (A-B) bytes is spread among all children of system.slice (with
  memory_recursiveprot)
- specifically B = 0 means foo.service shares the protection with all
  other services, it's not prioritized

Then there's third relevant value C -- the typical workingset size of
foo.service. You may get away with B < C.

Certainly, you will need to experiment with this to determine good
values that fit your setup.
(I'm not familiar with Wayland but if it critically depends on some
other services, you may need to protect them too.)


GL;HF,
Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210526/4dd1950a/attachment.sig>


More information about the systemd-devel mailing list