Search code examples
linux-kernelcgroups

Are cgroup isolated resources accessible for the process outside cgroup


I have a set of CPUs allocated for some processes via cgroups. Will these CPUs be accessible for the process that doesn't belong to any cgroup? Maight be a stupid question but I was not able to google the answer.


Solution

  • All processes belong to some cgroup when cgroups are enabled. If you didn't set it explicitly, the processes would belong to root cgroup. You can check it through

    # cat /proc/pid/cgroups

    CPUs don't get exclusively allocated in cgroups. When you set some cpus for a cgroup - say cpu 0 & 1 on a 4 cpu machine, processes in that cgroup will only have access to cpu 0 & 1. Every other cgroup and process can access all cpus (0-3).

    cpu masks are also hierarchical. You cannot remove a cpu from a parent cgroup if a child cgroup is using that cpu. Hope that helps.