How would I add entire session to a cgroup.

cgclassify seems to add just the specified PID.


I have to do it with a script that does something like this:

pidtree() {
  local _pid=$1
  for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
    pidtree ${_child}
  pidlist=$(ls -1 /proc/${_pid}/task)" $pidlist"
pidtree $1
cgcreate -g cpu:/job$1
cgclassify -g cpu:/job$1 $pidlist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.