From 6bb0084204bd93122c9f04391b80aea5a8a0ff08 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 15 Feb 2023 19:00:14 +0100 Subject: pid1: add unit file settings to control memory pressure logic --- man/systemd.resource-control.xml | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'man/systemd.resource-control.xml') diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index 27e29e853a..f057433973 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -1169,6 +1169,53 @@ DeviceAllow=/dev/loop-control + + + MemoryPressureWatch= + + Controls memory pressure monitoring for invoked processes. Takes one of + off, on, auto or skip. If + off tells the service not to watch for memory pressure events, by setting the + $MEMORY_PRESSURE_WATCH environment variable to the literal string + /dev/null. If on tells the service to watch for memory + pressure events. This enables memory accounting for the service, and ensures the + memory.pressure cgroup attribute files is accessible for read and write to the + service's user. It then sets the $MEMORY_PRESSURE_WATCH environment variable for + processes invoked by the unit to the file system path to this file. The threshold information + configured with MemoryPressureThresholdSec= is encoded in the + $MEMORY_PRESSURE_WRITE environment variable. If the auto value + is set the protocol is enabled if memory accounting is anyway enabled for the unit, and disabled + otherwise. If set to skip the logic is neither enabled, nor disabled and the two + environment variables are not set. + + Note that services are free to use the two environment variables, but it's unproblematic if + they ignore them. Memory pressure handling must be implemented individually in each service, and + usually means different things for different software. For further details on memory pressure + handling see Memory Pressure Handling in + systemd. + + Services implemented using + sd-event3 may use + sd_event_add_memory_pressure3 + to watch for and handle memory pressure events. + + If not explicit set, defaults to the DefaultMemoryPressureWatch= setting in + systemd-system.conf5. + + + + MemoryPressureThresholdSec= + + Sets the memory pressure threshold time for memory pressure monitor as configured via + MemoryPressureWatch=. Specifies the maximum allocation latency before a memory + pressure event is signalled to the service, per 1s window. If not specified defaults to the + DefaultMemoryPressureThresholdSec= setting in + systemd-system.conf5 + (which in turn defaults to 100ms). The specified value expects a time unit such as + ms or µs, see + systemd.time7 for + details on the permitted syntax. + -- cgit v1.2.1