@@ -18,7 +18,7 @@ cgroup_error_and_usage () {
18
18
exit 1
19
19
}
20
20
21
- # Check whether cgroup v2 is available .
21
+ # Check whether cgroup v2 is enabled .
22
22
fs_type=$( awk ' $2 == "/sys/fs/cgroup" {print $3}' /proc/mounts)
23
23
if [ " $fs_type " = " cgroup2" ]; then
24
24
kernel_version=$( uname -r)
@@ -34,25 +34,26 @@ You can try using cgroup V1 by adding systemd.unified_cgroup_hierarchy=0 to the
34
34
if ! echo " +cpuset" >> /sys/fs/cgroup/cgroup.subtree_control; then
35
35
cgroup_error_and_usage " Error: Cannot add +cpuset to cgroup.subtree_control; check kernel params. Unable to continue."
36
36
fi
37
- fi
38
37
39
- # Trying cgroup V1:
38
+ else # Trying cgroup V1:
40
39
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
46
46
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."
47
52
fi
48
- mkdir -p $CGROUPBASE /$i /domjudge
49
- done
50
53
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
54
55
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
56
58
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