[systemd-devel] Low memory dbus signal for GMemoryMonitor

Lennart Poettering lennart at poettering.net
Tue Nov 14 07:46:51 UTC 2023


On Di, 14.11.23 15:00, Kate Hsuan (hpa at redhat.com) wrote:

> Hi Folks,

Hi!

> Could systemd detect the system's low memory status and send a signal
> through Dbus about low memory events?

We already have an interface for this, it's documented here:

https://systemd.io/MEMORY_PRESSURE

It doesn't operate via D-Bus however, but instead just tells apps how
to directly get the events from the kernel. That's generally better
than bumping the events off two daemons (i.e. a memory pressure daemon
and a dbus broker), simply because memory pressure is a problem of
latency, and you should not add additional steps to the notifications
if you want to make things better and not worse. Moreover, on memory
pressure you shouldn't allocate more memory, which is something the
indirection through a daemon and broker would typically mean.

> We are looking for a new backend for GMemoryMonitor.
> https://developer-old.gnome.org/gio/stable/GMemoryMonitor.html
>
> The original backend- low-memory-monitor monitors the system memory
> usage. When it detects the memory is lower than a level, it signals
> the application. It also manages the kernel OOM.

It should be possibly to implement a GMemoryMonitor on top of the
kernel APIs directly, using the information systemd gives you. See the
documentation. It even briefly mentions GMemoryMonitor at the end.

If you have any questions about details, feel free to ask!

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list