@@ -18,7 +18,7 @@ cgroup_error_and_usage () {
1818 exit 1
1919}
2020
21- # Check whether cgroup v2 is available .
21+ # Check whether cgroup v2 is enabled .
2222fs_type=$( awk ' $2 == "/sys/fs/cgroup" {print $3}' /proc/mounts)
2323if [ " $fs_type " = " cgroup2" ]; then
2424 kernel_version=$( uname -r)
@@ -34,25 +34,26 @@ You can try using cgroup V1 by adding systemd.unified_cgroup_hierarchy=0 to the
3434 if ! echo " +cpuset" >> /sys/fs/cgroup/cgroup.subtree_control; then
3535 cgroup_error_and_usage " Error: Cannot add +cpuset to cgroup.subtree_control; check kernel params. Unable to continue."
3636 fi
37- fi
3837
39- # Trying cgroup V1:
38+ else # Trying cgroup V1:
4039
41- for i in cpuset memory; do
42- mkdir -p $CGROUPBASE /$i
43- if [ ! -d $CGROUPBASE /$i / ]; then
44- if ! mount -t cgroup -o$i $i $CGROUPBASE /$i /; then
45- cgroup_error_and_usage " Error: Can not mount $i cgroup. Probably cgroup support is missing from running kernel. Unable to continue."
40+ for i in cpuset memory; do
41+ mkdir -p $CGROUPBASE /$i
42+ if [ ! -d $CGROUPBASE /$i / ]; then
43+ if ! mount -t cgroup -o$i $i $CGROUPBASE /$i /; then
44+ cgroup_error_and_usage " Error: Can not mount $i cgroup. Probably cgroup support is missing from running kernel. Unable to continue."
45+ fi
4646 fi
47+ mkdir -p $CGROUPBASE /$i /domjudge
48+ done
49+
50+ if [ ! -f $CGROUPBASE /memory/memory.limit_in_bytes ] || [ ! -f $CGROUPBASE /memory/memory.memsw.limit_in_bytes ]; then
51+ cgroup_error_and_usage " Error: cgroup support missing memory features in running kernel. Unable to continue."
4752 fi
48- mkdir -p $CGROUPBASE /$i /domjudge
49- done
5053
51- if [ ! -f $CGROUPBASE /memory/memory.limit_in_bytes ] || [ ! -f $CGROUPBASE /memory/memory.memsw.limit_in_bytes ]; then
52- cgroup_error_and_usage " Error: cgroup support missing memory features in running kernel. Unable to continue."
53- fi
54+ chown -R $JUDGEHOSTUSER $CGROUPBASE /* /domjudge
5455
55- chown -R $JUDGEHOSTUSER $CGROUPBASE /* /domjudge
56+ cat $CGROUPBASE /cpuset/cpuset.cpus > $CGROUPBASE /cpuset/domjudge/cpuset.cpus
57+ cat $CGROUPBASE /cpuset/cpuset.mems > $CGROUPBASE /cpuset/domjudge/cpuset.mems
5658
57- cat $CGROUPBASE /cpuset/cpuset.cpus > $CGROUPBASE /cpuset/domjudge/cpuset.cpus
58- cat $CGROUPBASE /cpuset/cpuset.mems > $CGROUPBASE /cpuset/domjudge/cpuset.mems
59+ fi # cgroup V1
0 commit comments