shared/condition: remove cgroup hierarchy check (#37101)
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ static int short_uid_gid_range(UIDRangeUsernsMode mode) {
|
||||
}
|
||||
|
||||
char** taint_strv(void) {
|
||||
const char *stage[12] = {};
|
||||
const char *stage[11] = {};
|
||||
size_t n = 0;
|
||||
|
||||
/* Returns a "taint string", e.g. "local-hwclock:var-run-bad". Only things that are detected at
|
||||
|
||||
@@ -134,12 +134,6 @@ static int run(int argc, char *argv[]) {
|
||||
if (!is_pressure_supported())
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Pressure Stall Information (PSI) is not supported");
|
||||
|
||||
r = cg_all_unified();
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine whether the unified cgroups hierarchy is used: %m");
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Requires the unified cgroups hierarchy");
|
||||
|
||||
r = cg_mask_supported(&mask);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get supported cgroup controllers: %m");
|
||||
|
||||
@@ -46,9 +46,6 @@ static void test_oomd_cgroup_kill(void) {
|
||||
if (geteuid() != 0)
|
||||
return (void) log_tests_skipped("not root");
|
||||
|
||||
if (cg_all_unified() <= 0)
|
||||
return (void) log_tests_skipped("cgroups are not running in unified mode");
|
||||
|
||||
assert_se(cg_pid_get_path(NULL, 0, &cgroup_root) >= 0);
|
||||
|
||||
/* Create another cgroup below this one for the pids we forked off. We need this to be managed
|
||||
@@ -103,9 +100,6 @@ static void test_oomd_cgroup_context_acquire_and_insert(void) {
|
||||
if (!is_pressure_supported())
|
||||
return (void) log_tests_skipped("system does not support pressure");
|
||||
|
||||
if (cg_all_unified() <= 0)
|
||||
return (void) log_tests_skipped("cgroups are not running in unified mode");
|
||||
|
||||
assert_se(cg_mask_supported(&mask) >= 0);
|
||||
|
||||
if (!FLAGS_SET(mask, CGROUP_MASK_MEMORY))
|
||||
@@ -429,9 +423,6 @@ static void test_oomd_fetch_cgroup_oom_preference(void) {
|
||||
if (!is_pressure_supported())
|
||||
return (void) log_tests_skipped("system does not support pressure");
|
||||
|
||||
if (cg_all_unified() <= 0)
|
||||
return (void) log_tests_skipped("cgroups are not running in unified mode");
|
||||
|
||||
assert_se(cg_mask_supported(&mask) >= 0);
|
||||
|
||||
if (!FLAGS_SET(mask, CGROUP_MASK_MEMORY))
|
||||
|
||||
+5
-17
@@ -411,21 +411,17 @@ static int condition_test_user(Condition *c, char **env) {
|
||||
}
|
||||
|
||||
static int condition_test_control_group_controller(Condition *c, char **env) {
|
||||
CGroupMask system_mask, wanted_mask;
|
||||
int r;
|
||||
CGroupMask system_mask, wanted_mask = 0;
|
||||
|
||||
assert(c);
|
||||
assert(c->parameter);
|
||||
assert(c->type == CONDITION_CONTROL_GROUP_CONTROLLER);
|
||||
|
||||
if (streq(c->parameter, "v2"))
|
||||
return cg_all_unified();
|
||||
if (streq(c->parameter, "v1")) {
|
||||
r = cg_all_unified();
|
||||
if (r < 0)
|
||||
return r;
|
||||
return !r;
|
||||
}
|
||||
return true;
|
||||
if (streq(c->parameter, "v1"))
|
||||
return false;
|
||||
|
||||
r = cg_mask_supported(&system_mask);
|
||||
if (r < 0)
|
||||
@@ -437,7 +433,7 @@ static int condition_test_control_group_controller(Condition *c, char **env) {
|
||||
* mixed in with valid ones -- these are only assessed on the
|
||||
* validity of the valid controllers found. */
|
||||
log_debug("Failed to parse cgroup string: %s", c->parameter);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FLAGS_SET(system_mask, wanted_mask);
|
||||
@@ -1085,14 +1081,6 @@ static int condition_test_psi(Condition *c, char **env) {
|
||||
if (!slice)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to parse condition parameter %s.", c->parameter);
|
||||
|
||||
r = cg_all_unified();
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to determine whether the unified cgroups hierarchy is used: %m");
|
||||
if (r == 0) {
|
||||
log_debug("PSI condition check requires the unified cgroups hierarchy, skipping.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
r = cg_mask_supported(&mask);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to get supported cgroup controllers: %m");
|
||||
|
||||
@@ -15,7 +15,6 @@ DefaultDependencies=no
|
||||
After=swap.target
|
||||
Before=multi-user.target shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
ConditionControlGroupController=v2
|
||||
ConditionControlGroupController=memory
|
||||
ConditionPathExists=/proc/pressure/cpu
|
||||
ConditionPathExists=/proc/pressure/io
|
||||
|
||||
@@ -13,7 +13,6 @@ Documentation=man:systemd-oomd.service(8)
|
||||
DefaultDependencies=no
|
||||
Before=sockets.target shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
ConditionControlGroupController=v2
|
||||
ConditionControlGroupController=memory
|
||||
ConditionPathExists=/proc/pressure/cpu
|
||||
ConditionPathExists=/proc/pressure/io
|
||||
|
||||
Reference in New Issue
Block a user