- Verify that
cpuandcpusetare in this file# cat /sys/fs/cgroup/cgroup.controllers - Enable cpu-related controllers
- Create the cgroup for our segmented experiment cores
# mkdir /sys/fs/cgroup/experiment/ - Set the cpus for the experiment cgroup
# echo "3-6" > /sys/fs/cgroup/experiment/cpuset.cpus - Set the memory node for the experiment cgroup
# echo 0 > /sys/fs/cgroup/experiment/cpuset.mems - Set the cpuset for the experiment cgroup to cpu_exclusive mode
# echo "3-6" > /sys/fs/cgroup/experiment/cpuset.cpus.exclusive - Create the cgroup for everything else
# mkdir /sys/fs/cgroup/notexperiment/ - Set the cpus for the notexperiment cgroup
# echo "1-2,7-15" > /sys/fs/cgroup/notexperiment/cpuset.cpus - Set the memory node for the notexperiment cgroup
# echo 0 > /sys/fs/cgroup/notexperiment/cpuset.mems - Set the cpuset for the notexperiment cgroup to cpu_exclusive mode
# echo "1-2,7-15" > /sys/fs/cgroup/notexperiment/cpuset.cpus.exclusive - Move all the existing tasks to the notexperiment cgroup
# ps -eLo lwp | while read thread; do echo $thread > /sys/fs/cgroup/notexperiment/cgroup.procs; done - Move the shell into the experiment cgroup and then use it to start the experiment program.
# echo $$ > /sys/fs/cgroup/experiment/cgroup.procs - Set the two cgroups to be root cgroups, so they can have true exclusive access to the resources we've allocated to them.
# echo "root" > /sys/fs/cgroup/notexperiment/cpuset.cpus.partition
# echo "root" > /sys/fs/cgroup/experiment/cpuset.cpus.partition - Verify that the only processes running on the isolated cpus are kernel threads
# ps -e -o pid,psr,cmd | awk '$2 >= 3 && $2 <= 6' | sort -k2,2n