3535#include " utilities/globalDefinitions.hpp"
3636
3737// controller names have to match the *_IDX indices
38- static const char * cg_controller_name[] = { " cpu " , " cpuset " , " cpuacct" , " memory" , " pids" };
38+ static const char * cg_controller_name[] = { " cpuset " , " cpu " , " cpuacct" , " memory" , " pids" };
3939
4040CgroupSubsystem* CgroupSubsystemFactory::create () {
4141 CgroupV1MemoryController* memory = NULL ;
@@ -159,9 +159,10 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
159159 char buf[MAXPATHLEN+1 ];
160160 char *p;
161161 bool is_cgroupsV2;
162- // true iff all required controllers, memory, cpu, cpuset, cpuacct are enabled
162+ // true iff all required controllers, memory, cpu, cpuacct are enabled
163163 // at the kernel level.
164164 // pids might not be enabled on older Linux distros (SLES 12.1, RHEL 7.1)
165+ // cpuset might not be enabled on newer Linux distros (Fedora 41)
165166 bool all_required_controllers_enabled;
166167
167168 /*
@@ -193,6 +194,7 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
193194 cg_infos[MEMORY_IDX]._hierarchy_id = hierarchy_id;
194195 cg_infos[MEMORY_IDX]._enabled = (enabled == 1 );
195196 } else if (strcmp (name, " cpuset" ) == 0 ) {
197+ log_debug (os, container)(" Detected optional cpuset controller entry in %s" , proc_cgroups);
196198 cg_infos[CPUSET_IDX]._name = os::strdup (name);
197199 cg_infos[CPUSET_IDX]._hierarchy_id = hierarchy_id;
198200 cg_infos[CPUSET_IDX]._enabled = (enabled == 1 );
@@ -216,8 +218,8 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
216218 is_cgroupsV2 = true ;
217219 all_required_controllers_enabled = true ;
218220 for (int i = 0 ; i < CG_INFO_LENGTH; i++) {
219- // pids controller is optional. All other controllers are required
220- if (i != PIDS_IDX) {
221+ // pids and cpuset controllers are optional. All other controllers are required
222+ if (i != PIDS_IDX && i != CPUSET_IDX ) {
221223 is_cgroupsV2 = is_cgroupsV2 && cg_infos[i]._hierarchy_id == 0 ;
222224 all_required_controllers_enabled = all_required_controllers_enabled && cg_infos[i]._enabled ;
223225 }
0 commit comments