Skip to content

Commit 2de71d0

Browse files
committed
8347129: cpuset cgroups controller is required for no good reason
Reviewed-by: stuefe, asmehra
1 parent 4c30933 commit 2de71d0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/hotspot/os/linux/cgroupSubsystem_linux.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "utilities/globalDefinitions.hpp"
3838

3939
// controller names have to match the *_IDX indices
40-
static const char* cg_controller_name[] = { "cpu", "cpuset", "cpuacct", "memory", "pids" };
40+
static const char* cg_controller_name[] = { "cpuset", "cpu", "cpuacct", "memory", "pids" };
4141

4242
CgroupSubsystem* CgroupSubsystemFactory::create() {
4343
CgroupV1MemoryController* memory = nullptr;
@@ -226,9 +226,10 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
226226
char buf[MAXPATHLEN+1];
227227
char *p;
228228
bool is_cgroupsV2;
229-
// true iff all required controllers, memory, cpu, cpuset, cpuacct are enabled
229+
// true iff all required controllers, memory, cpu, cpuacct are enabled
230230
// at the kernel level.
231231
// pids might not be enabled on older Linux distros (SLES 12.1, RHEL 7.1)
232+
// cpuset might not be enabled on newer Linux distros (Fedora 41)
232233
bool all_required_controllers_enabled;
233234

234235
/*
@@ -260,6 +261,7 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
260261
cg_infos[MEMORY_IDX]._hierarchy_id = hierarchy_id;
261262
cg_infos[MEMORY_IDX]._enabled = (enabled == 1);
262263
} else if (strcmp(name, "cpuset") == 0) {
264+
log_debug(os, container)("Detected optional cpuset controller entry in %s", proc_cgroups);
263265
cg_infos[CPUSET_IDX]._name = os::strdup(name);
264266
cg_infos[CPUSET_IDX]._hierarchy_id = hierarchy_id;
265267
cg_infos[CPUSET_IDX]._enabled = (enabled == 1);
@@ -283,8 +285,8 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
283285
is_cgroupsV2 = true;
284286
all_required_controllers_enabled = true;
285287
for (int i = 0; i < CG_INFO_LENGTH; i++) {
286-
// pids controller is optional. All other controllers are required
287-
if (i != PIDS_IDX) {
288+
// pids and cpuset controllers are optional. All other controllers are required
289+
if (i != PIDS_IDX && i != CPUSET_IDX) {
288290
is_cgroupsV2 = is_cgroupsV2 && cg_infos[i]._hierarchy_id == 0;
289291
all_required_controllers_enabled = all_required_controllers_enabled && cg_infos[i]._enabled;
290292
}

0 commit comments

Comments
 (0)