Skip to content

Commit

Permalink
add cgroup cpu capping
Browse files Browse the repository at this point in the history
  • Loading branch information
toralf committed Jan 26, 2024
1 parent 909f394 commit 33fa69b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fuzz-cgroup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ function CreateCgroup() {
local name=$cgdomain/${1?}
local pid=${2?}

# put all fuzzers under 1 sub group
if [[ ! -d $cgdomain ]]; then
mkdir $cgdomain
echo "+cpu +memory" >$cgdomain/cgroup.subtree_control
echo "+cpu +cpuset +memory" >$cgdomain/cgroup.subtree_control

echo "400" >$cgdomain/cpu.weight
# 4 vCPU for all
echo "$((4 * 100))" >$cgdomain/cpu.weight
echo "$((4 * 100000)) 100000" >$cgdomain/cpu.max
echo "40G" >$cgdomain/memory.max
echo "20G" >$cgdomain/memory.swap.max
fi

mkdir $name || return 13
echo "$pid" >$name/cgroup.procs
# 1 vCPU per fuzzer
echo "$((100 * 1))" >$name/cpu.weight
echo "$((100000 * 1))" >$name/cpu.max
echo "8G" >$name/memory.max
echo "0G" >$name/memory.swap.max
}
Expand Down

0 comments on commit 33fa69b

Please sign in to comment.