From 158fe190afe37b222c9dc2c53bd7be426b92ef89 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 10 Feb 2023 16:44:24 +0100 Subject: sd-event: add high-level sd_event_add_memory_pressure() event source Typically, in reasonably complex programs we want to realease various caches (such as glibc allocation caches) in case of memory pressure. Let's add explicit infrastructure for that to sd-event, that can hook Linux' Pressure Stall Information (PSI) logic with our event loop. This adds sd_event_add_memory_pressure() as easy, one-step API to install an even source that is called under memory pressure. The parameters which file to watch (the per-cgroup PSI file, or the system-wide file /proc/pressure/memory) can be configured via env vars. The idea is that the service manager sooner or later gains controls for setting this up correctly. Alternatively to the PSI a similar logic is supported but instead of waiting for POLLPRI on a procfs/cgroupfs fd we'll wait for POLLIN on FIFO or AF_UNIX sockets. This is useful for testing, and possibly in other environments, for example to hook up this protocol directly with GNOME's low memory monitor. By default this watches on the cgroup-local PSI so that we aren't affected by pressure on cgroups we are not related to. --- catalog/systemd.catalog.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'catalog') diff --git a/catalog/systemd.catalog.in b/catalog/systemd.catalog.in index 975e77fcec..82d4820b80 100644 --- a/catalog/systemd.catalog.in +++ b/catalog/systemd.catalog.in @@ -549,3 +549,18 @@ Whenever the system transitions to a new runtime phase, the specified PCR is extended with a different string, to ensure that security policies for TPM-bound secrets and other resources are limited to specific phases of the runtime. + +-- f9b0be465ad540d0850ad32172d57c21 +Subject: Memory Trimmed +Defined-By: systemd +Support: %SUPPORT_URL% + +Memory of process @_PID@ (@_COMM@) has been trimmed. + +Either on user request or as result of a memory pressure event, memory of the +process has been trimmed, returning unneded allocation caches and other +resources back to the OS kernel, making them available for other components of +the OS. + +@TRIMMED_BYTES@ of memory were returned to the OS, which took @TRIMMED_USEC@ +micro-seconds (µs). -- cgit v1.2.3