summaryrefslogtreecommitdiffstats
path: root/src/shared/condition.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:19:03 +0000
commit2b689e3af421bdd35ccd34cdc733d4d8a40843b3 (patch)
treedc0754b353914d026743560b8fa8977dc407fe99 /src/shared/condition.c
parentReleasing progress-linux version 256.1-2~progress7.99u1. (diff)
downloadsystemd-2b689e3af421bdd35ccd34cdc733d4d8a40843b3.tar.xz
systemd-2b689e3af421bdd35ccd34cdc733d4d8a40843b3.zip
Merging upstream version 256.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shared/condition.c')
-rw-r--r--src/shared/condition.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/shared/condition.c b/src/shared/condition.c
index b53b2ef..1f72ba8 100644
--- a/src/shared/condition.c
+++ b/src/shared/condition.c
@@ -1009,6 +1009,7 @@ static int condition_test_psi(Condition *c, char **env) {
loadavg_t *current, limit;
ResourcePressure pressure;
int r;
+ PressureType preferred_pressure_type = PRESSURE_TYPE_FULL;
assert(c);
assert(c->parameter);
@@ -1029,6 +1030,10 @@ static int condition_test_psi(Condition *c, char **env) {
return log_debug_errno(r < 0 ? r : SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s: %m", c->parameter);
/* If only one parameter is passed, then we look at the global system pressure rather than a specific cgroup. */
if (r == 1) {
+ /* cpu.pressure 'full' is reported but undefined at system level */
+ if(c->type == CONDITION_CPU_PRESSURE)
+ preferred_pressure_type = PRESSURE_TYPE_SOME;
+
pressure_path = path_join("/proc/pressure", pressure_type);
if (!pressure_path)
return log_oom_debug();
@@ -1133,8 +1138,9 @@ static int condition_test_psi(Condition *c, char **env) {
if (r < 0)
return log_debug_errno(r, "Failed to parse loadavg: %s", c->parameter);
- r = read_resource_pressure(pressure_path, PRESSURE_TYPE_FULL, &pressure);
- if (r == -ENODATA) /* cpu.pressure 'full' was added recently, fall back to 'some'. */
+ r = read_resource_pressure(pressure_path, preferred_pressure_type, &pressure);
+ /* cpu.pressure 'full' was recently added at cgroup level, fall back to 'some' */
+ if (r == -ENODATA && preferred_pressure_type == PRESSURE_TYPE_FULL)
r = read_resource_pressure(pressure_path, PRESSURE_TYPE_SOME, &pressure);
if (r == -ENOENT) {
/* We already checked that /proc/pressure exists, so this means we were given a cgroup