File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,12 @@ Optionally the timings can be made more stable by not letting the OS schedule
179179any other tasks on the same CPU core the judgedaemon is using:
180180``GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1 isolcpus=2" ``
181181
182+ On modern systems where cgroup v2 is available, DOMjudge will try to
183+ use that. This requires kernel versions 5.20 or 6.0 or later to
184+ support reporting peak memory usage. If not found, the system will try
185+ to fall back to cgroup v1, but this might require you to add
186+ ``systemd.unified_cgroup_hierarchy=0 `` to the boot options as well.
187+
182188You have now configured the system to use cgroups. To create
183189the actual cgroups that DOMjudge will use you need to run::
184190
Original file line number Diff line number Diff line change @@ -19,23 +19,30 @@ cgroup_error_and_usage () {
1919}
2020
2121# Check whether cgroup v2 is available.
22+ cgroupv2_available=' '
2223fs_type=$( awk ' $2 == "/sys/fs/cgroup" {print $3}' /proc/mounts)
2324if [ " $fs_type " = " cgroup2" ]; then
2425 kernel_version=$( uname -r)
2526 major=$( echo " $kernel_version " | cut -d ' .' -f 1)
2627 minor=$( echo " $kernel_version " | cut -d ' .' -f 2)
2728 if [ " $major " -lt 5 ] || { [ " $major " -eq 5 ] && [ " $minor " -lt 19 ]; }; then
28- echo " WARNING: Kernel ($kernel_version ) is too old to record peak RAM usage" >&2
29+ echo " Kernel ($kernel_version ) is too old to record peak RAM usage with cgroup V2, trying cgroup V1" >&2
30+ else
31+ cgroupv2_available=1
2932 fi
33+ fi
34+
35+ if [ -n " $cgroupv2_available " ]; then
3036 if ! echo " +memory" >> /sys/fs/cgroup/cgroup.subtree_control; then
3137 cgroup_error_and_usage " Error: Cannot add +memory to cgroup.subtree_control; check kernel params. Unable to continue."
3238 fi
3339 if ! echo " +cpuset" >> /sys/fs/cgroup/cgroup.subtree_control; then
3440 cgroup_error_and_usage " Error: Cannot add +cpuset to cgroup.subtree_control; check kernel params. Unable to continue."
3541 fi
36- exit 0
3742fi
3843
44+ # Trying cgroup V1:
45+
3946for i in cpuset memory; do
4047 mkdir -p $CGROUPBASE /$i
4148 if [ ! -d $CGROUPBASE /$i / ]; then
You can’t perform that action at this time.
0 commit comments