8 # From cgconfig init.d script
9 create_default_groups
() {
12 if [ -f /etc
/cgrules.conf
]
14 read user ctrl defaultcgroup
<<< \
15 $
(grep -m1 ^\
* /etc
/cgrules.conf
)
16 if [[ -n $defaultcgroup && $defaultcgroup = "*" ]]
22 if [ -z $defaultcgroup ]
24 defaultcgroup
=sysdefault
/
28 # Find all mounted subsystems and create comma-separated list
31 controllers
=$
(lssubsys
2>/dev
/null |
tr '\n' ',' |
sed s
/.$
//)
34 # Create the default group, ignore errors when the default group
37 cgcreate
-g $controllers:$defaultcgroup 2>/dev
/null
40 # special rule for cpusets
42 if echo $controllers |
grep -q -w cpuset
; then
43 cpus
=$
(cgget
-nv -r cpuset.cpus
/)
44 cgset
-r cpuset.cpus
=$cpus $defaultcgroup
45 mems
=$
(cgget
-nv -r cpuset.mems
/)
46 cgset
-r cpuset.mems
=$mems $defaultcgroup
50 # special rule for cpus
52 if echo $controllers |
grep -q -w cpu
; then
53 rt_runtime_us
=$
(cgget
-nv -r cpu.rt_runtime_us
/)
54 cgset
-r cpu.rt_runtime_us
=$rt_runtime_us $defaultcgroup
58 # Classify everything to default cgroup. Ignore errors, some processes
59 # may exit after ps is run and before cgclassify moves them.
61 cgclassify
-g $controllers:$defaultcgroup $
(ps
--no-headers -eL o tid
) \
67 stat_busy
"Starting CGroups configuration"
68 /usr
/sbin
/cgconfigparser
-l /etc
/cgconfig.conf
72 if [ $CREATE_DEFAULT == "yes" ]; then
80 stat_busy
"Clearing CGroups configuration"
95 echo "usage: $0 {start|stop|restart}"