cgclassify does not move threads of a process into cgroup.
Environment
- RHEL6
- libcgroup-0.40.rc1-24.el6_9.x86_64
Issue
- cgclassify does not move threads of a process into cgroup.
- cgclassify moves only the thread group leader into the control group.
Resolution
- This has been fixed in libcgroup-0.40.rc1-27.el6_10
Root Cause
- Previously libcgroup could operate only on individual threads and processes.
- Hence libcgroup tools like 'cgclassify' was moving only the thread group leader of a multi-threaded process into the control group.
Diagnostic Steps
- Using cgclassify tool to move a multi-threaded process like rsyslogd, Moved only the thread group leader into the control group.
- Before moving the process into the control group.
# ps -eLo pid,ppid,tid,lwp,psr,pcpu,stat,start,cmd,thcgr | grep rsyslo
1650 1 1650 1650 0 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
1650 1 1651 1651 2 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
1650 1 1652 1652 0 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
1650 1 1653 1653 0 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
- After moving the process using cgclassify notice that only the tgid is reflecting the control group and other threads are still in the default root control group.
# ps -eLo pid,ppid,tid,lwp,psr,pcpu,stat,start,cmd,thcgr | grep rsyslo
1650 1 1650 1650 0 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/thread-test
1650 1 1651 1651 2 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
1650 1 1652 1652 0 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
1650 1 1653 1653 0 0.0 Sl 18:19:53 /sbin/rsyslogd -i /var/run/ blkio:/;net_cls:/;freezer:/;devices:/;memory:/;cpuacct:/;cpu:/;cpuset:/
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
