Introduce a new wsl.conf config value to allow distributions to opt-in to cgroupv1 mounts by OneBlue · Pull Request #13546 · microsoft/WSL
| auto position = commandLine.find(CGROUPS_NO_V1); | |
| if (position != std::string::npos) | |
| { | |
| auto list = commandLine.substr(position + sizeof(CGROUPS_NO_V1) - 1); | |
| auto end = list.find_first_of(" \n"); | |
| if (end != std::string::npos) | |
| { | |
| list = list.substr(0, end); | |
| } | |
| if (list == "all") | |
| { | |
| LOG_WARNING("Distribution has cgroupv1 enabled, but kernel command line has {}all. Falling back to cgroupv2", CGROUPS_NO_V1); | |
| Config.CGroup = WslDistributionConfig::CGroupVersion::v2; | |
| } | |
| else | |
| { | |
| DisabledControllers = wsl::shared::string::Split(list, ','); | |
| } | |
| if (!commandLine.empty()) { | |
| auto position = commandLine.find(CGROUPS_NO_V1); | |
| if (position != std::string::npos) | |
| { | |
| auto list = commandLine.substr(position + sizeof(CGROUPS_NO_V1) - 1); | |
| auto end = list.find_first_of(" \n"); | |
| if (end != std::string::npos) | |
| { | |
| list = list.substr(0, end); | |
| } | |
| if (list == "all") | |
| { | |
| LOG_WARNING("Distribution has cgroupv1 enabled, but kernel command line has {}all. Falling back to cgroupv2", CGROUPS_NO_V1); | |
| Config.CGroup = WslDistributionConfig::CGroupVersion::v2; | |
| } | |
| else | |
| { | |
| DisabledControllers = wsl::shared::string::Split(list, ','); | |
| } | |
| } | |
| } else { | |
| LOG_WARNING("Failed to read /proc/cmdline; skipping cgroup_no_v1 check."); |