From e111e38c12a6d69c9a592dff8f7a91b1642145b3 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Thu, 20 May 2021 09:45:33 -0700 Subject: [PATCH] (#1962255) Split off systemd-oomd into a subpackage Resolves: rhbz#1962255 Signed-off-by: Davide Cavalca --- split-files.py | 11 ++++++++--- systemd.spec | 37 +++++++------------------------------ 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/split-files.py b/split-files.py index 5711b7c..11ea58a 100644 --- a/split-files.py +++ b/split-files.py @@ -23,7 +23,7 @@ o_devel = open('.file-list-devel', 'w') o_container = open('.file-list-container', 'w') o_networkd = open('.file-list-networkd', 'w') o_resolved = open('.file-list-resolved', 'w') -o_oomd_defaults = open('.file-list-oomd-defaults', 'w') +o_oomd = open('.file-list-oomd', 'w') o_remote = open('.file-list-remote', 'w') o_tests = open('.file-list-tests', 'w') o_standalone_tmpfiles = open('.file-list-standalone-tmpfiles', 'w') @@ -126,8 +126,13 @@ for file in files(buildroot): /modprobe.d ''', n, re.X): o = o_udev - elif re.search(r'10-oomd-.*defaults.conf|lib/systemd/oomd.conf.d', n, re.X): - o = o_oomd_defaults + elif re.search(r'''10-oomd-.*defaults\.conf| + oomd\.conf| + oomctl| + org.freedesktop.oom1| + systemd-oomd + ''', n, re.X): + o = o_oomd elif n.endswith('.standalone'): if 'tmpfiles' in n: o = o_standalone_tmpfiles diff --git a/systemd.spec b/systemd.spec index 8abb9eb..71f2659 100644 --- a/systemd.spec +++ b/systemd.spec @@ -335,14 +335,15 @@ resolution to local applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR and MulticastDNS resolver and responder. -%package oomd-defaults -Summary: Configuration files for systemd-oomd +%package oomd +Summary: A userspace out-of-memory (OOM) killer Requires: %{name}%{?_isa} = %{version}-%{release} License: LGPLv2+ -%description oomd-defaults -A set of drop-in files for systemd units to enable action from systemd-oomd, -a userspace out-of-memory (OOM) killer. +%description oomd +systemd-oomd is a system service that uses cgroups-v2 and pressure stall +information (PSI) to monitor and take action on processes before an OOM +occurs in kernel space. %package standalone-tmpfiles Summary: Standalone tmpfiles binary for use in non-systemd systems @@ -631,20 +632,6 @@ getent passwd systemd-oom &>/dev/null || useradd -r -l -g systemd-oom -d / -s /s %post systemd-machine-id-setup &>/dev/null || : -# FIXME: move to %postun. We want to restart systemd *after* removing -# files from the old rpm. Right now we may still have bits the old -# setup if the files are not present in the new version. But before -# implement restarting of *other* services after the transaction, moving -# this would make things worse, increasing the number of warnings we get -# about needed daemon-reload. - -oomd_state=$(systemctl is-active systemd-oomd 2>/dev/null || :) - -# Work-around for #1931034. Remove after F34 is released. -if [ "$oomd_state" == "active" ]; then - systemctl stop -q systemd-oomd 2>/dev/null || : -fi - systemctl daemon-reexec &>/dev/null || { # systemd v239 had bug #9553 in D-Bus authentication of the private socket, # which was later fixed in v240 by #9625. @@ -665,10 +652,6 @@ systemctl daemon-reexec &>/dev/null || { fi } -if [ "$oomd_state" == "active" ]; then - systemctl start -q systemd-oomd 2>/dev/null || : -fi - if [ $1 -eq 1 ]; then # create /var/log/journal only on initial installation, # and only if it's writable (it won't be in rpm-ostree). @@ -706,12 +689,6 @@ fi %systemd_postun_with_restart systemd-timedated.service systemd-hostnamed.service systemd-journald.service systemd-localed.service systemd-oomd.service -%triggerpostun -- systemd < 247.3-2 -# This is for upgrades from previous versions before oomd-defaults is available. -# We use %%triggerpostun here because rpm doesn't allow a second %%triggerun with -# a different package version. -systemctl --no-reload preset systemd-oomd.service &>/dev/null || : - %post libs %{?ldconfig} @@ -857,7 +834,7 @@ getent passwd systemd-resolve &>/dev/null || useradd -r -u 193 -l -g systemd-res %files resolved -f .file-list-resolved -%files oomd-defaults -f .file-list-oomd-defaults +%files oomd -f .file-list-oomd %files standalone-tmpfiles -f .file-list-standalone-tmpfiles