How can I avoid child inheriting the cgroup of parent?
In my system I have some cgroup hierarchy, one of the process is running under some particular cgroup and it spawn some process, and the child is by default running under same cgroup, but I don't want it to inherit parent cgroup. Is there any way to do it by using some API?
During my research to find this answer I have seen that since new scheduler were merged in Linux 2.6.23, a new CFS scheduler was introduced. This scheduler also support group scheduling, which let number of task running for a particular request to share the cpu among them, i.e to give all of them fair chance. So, during a child is being forked , the child will be the part of parent CGROUP. Later we can run these task to different cgroup, just by writing it to different cgroup, it is just a matter of:
echo >
For more detail on cgroup, please look into the linux documentation.