2

How would I add entire session to a cgroup.

cgclassify seems to add just the specified PID.

0

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

pidtree=
pidtree() {
  local _pid=$1
  for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
    pidtree ${_child}
  done
  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.