`Control Groups` consists of two parts - is an upstream kernel feature that allows system resources to be partitioned/divided up amongst different processes, or a group of processes. The second part is to improve existing tools which handles with kernel control groups mechanism where necessary and feasible and/or to create new ones e.g. to create or modify cgroups configuration or display control groups data (using libcgroups package).
- Linda Wang
- email: email@example.com
- Nils Philippsen
- email: firstname.lastname@example.org
- Ivana Varekova
- email: email@example.com
- Jan Šafránek
- email: firstname.lastname@example.org
- Targeted release:
- Last updated: 2009-02-10
- Percentage of completion: 20%
Since kernel 2.6.24, Linux has so called control groups as a means to partition available resources between running processes. Libcgroups makes that functionality available to programmers and contains two tools,
cgclassify, to start processes in a control group or move existing processes from one control group to another.
In Fedora there already is a package libcgroups with aforementioned tools, but the overall quality is very poor. There is almost no documentation, no man pages, no configuration file samples.
The goal for Fedora 11 is to improve this package where necessary, i.e.:
- add/fix documentation and man-pages
- add examples
- fix error handling
- rework logging
- create displaying tool (to see, in which control group is given process)
- prepare a way, how to start a service daemon in given context group
The long term goal is to create new tools to e.g. create or modify persistent cgroups configuration and display control groups data. At the beginning the focus will be on command line tools, but we'll keep in mind that in the long term we'll likely want to have graphical tools. These would offer similar functionality and we should try to make sure that any non-UI code written is usable from both kinds of frontends.
Benefit to Fedora
Libcgroups handles the new kernel features which are able to restrict the sources for tasks. This project should help the user to make the best of this feature.
Required extended testing and fixing of libcgroups package and in time when libcgroups will be stable enough try to add start to write another parts - based on existing ones.
How To Test
For now it is necessary to have a kernel with cgroups support (
Documentation/cgroups/cgroups.txt) and the
libcgroup package. The user/tester must know, what cgroups are and what they are good for, the best is to read aforementioned kernel doc.
1. yum install libcgroup
- Creating cgroups:
/etc/cgconfig.conffile - there should be nice example and man page packaged.
- Start/stop cgconfig service and test whether the created groups are as expected.
- Moving task to groups:
- Prepare some cgroups, i.e. prepare
- Start/stop new proces using
cgexecand check that it's in appropriate cgroup.
cgrules.conffile - there should be some sample and man page available.
cgrulesengddaemon (it should automatically move processes as written in
- Configure cgroup pam module and test that works if a user logs in (again, driven by
libcgroups package has several bugs, these will have to be fixed at first. When that is out of the way, configuration (or even monitoring) tools would reduce the barrier of entry to using control groups on Linux significantly.
- Depends on kernel > 2.6.24 and
libcgroups(current version is 0.32.2) which both are in Fedora since F-9.
Currently, nothing depends on
libcgroup or the tools which would use it. If things go really wrong, we can always go back to the last working version of
- kernel documentation:
libcgroups is a tool which helps to manipulate, control and administrate control groups and the associated controllers. Using this tool it is possible to aggregate/partition set of tasks and their future children into hierarchical groups with specialized access to resources.
The tool consists of two parts -
- The first one enables user to create persistent cgroups configuration using a configuration file and a service which creates configured groups on startup.
- The second part enables user to define to which group belong the given process/given processes. This divison is based on uid or gid of processes. The user can start a service which will put the processes to the right subsystem, or there is a tool to move the process to the right subsystem or to create the process in it.