Skip to content
Merged
Changes from 4 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
4 changes: 3 additions & 1 deletion hooks/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ function common::get_cpu_num {

local cpu_quota cpu_period cpu_num

local wslinterop_path="/proc/sys/fs/binfmt_misc/WSLInterop"
Comment thread
yermulnik marked this conversation as resolved.
Outdated

if [[ -f /sys/fs/cgroup/cpu/cpu.cfs_quota_us &&
! -f /proc/sys/fs/binfmt_misc/WSLInterop ]]; then # WSL have cfs_quota_us, but WSL should be checked as usual Linux host
(! -f "${wslinterop_path}" && ! -f "${wslinterop_path}-late") ]]; then # WSL has cfs_quota_us, but WSL should be checked as usual Linux host
# Inside K8s pod or DinD in K8s
cpu_quota=$(< /sys/fs/cgroup/cpu/cpu.cfs_quota_us)
cpu_period=$(cat /sys/fs/cgroup/cpu/cpu.cfs_period_us 2> /dev/null || echo "$cpu_quota")
Expand Down
Loading