Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit warning if memory.peak cannot be be captured with cgroup v2. #2775

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions judge/create_cgroups.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ cgroup_error_and_usage () {
# Check whether cgroup v2 is available.
fs_type=$(awk '$2 == "/sys/fs/cgroup" {print $3}' /proc/mounts)
if [ "$fs_type" = "cgroup2" ]; then
kernel_version=$(uname -r)
major=$(echo "$kernel_version" | cut -d '.' -f 1)
minor=$(echo "$kernel_version" | cut -d '.' -f 2)
if [ "$major" -lt 5 ] || { [ "$major" -eq 5 ] && [ "$minor" -lt 19 ]; }; then
echo "WARNING: Kernel ($kernel_version) is too old to record peak RAM usage" >&2
fi
if ! echo "+memory" >> /sys/fs/cgroup/cgroup.subtree_control; then
cgroup_error_and_usage "Error: Cannot add +memory to cgroup.subtree_control; check kernel params. Unable to continue."
cgroup_error_and_usage "Error: Cannot add +memory to cgroup.subtree_control; check kernel params. Unable to continue."
fi
if ! echo "+cpuset" >> /sys/fs/cgroup/cgroup.subtree_control; then
cgroup_error_and_usage "Error: Cannot add +cpuset to cgroup.subtree_control; check kernel params. Unable to continue."
cgroup_error_and_usage "Error: Cannot add +cpuset to cgroup.subtree_control; check kernel params. Unable to continue."
fi
exit 0
fi
Expand Down
Loading