8 # From cgconfig init.d script
9 create_default_groups
() {
12 if [ -f /etc
/cgrules.conf
]; then
13 grep -m1 '^\*[[:space:]]\+' /etc
/cgrules.conf | \
14 read user ctrl defaultcgroup
15 if [ -n $defaultcgroup -a $defaultcgroup = "*" ]; then
20 if [ -z $defaultcgroup ]; then
21 defaultcgroup
=sysdefault
/
25 # Find all mounted subsystems and create comma-separated list
28 controllers
=$
(lssubsys
2>/dev
/null |
tr '\n' ',' |
sed s
/.$
//)
31 # Create the default group, ignore errors when the default group
34 cgcreate
-f 664 -d 775 -g $controllers:$defaultcgroup 2>/dev
/null
37 # special rule for cpusets
39 if echo $controllers |
grep -q -w cpuset
; then
40 cpus
=$
(cgget
-nv -r cpuset.cpus
/)
41 cgset
-r cpuset.cpus
=$cpus $defaultcgroup
42 mems
=$
(cgget
-nv -r cpuset.mems
/)
43 cgset
-r cpuset.mems
=$mems $defaultcgroup
47 # special rule for cpus
49 if echo $controllers |
grep -q -w cpu
; then
50 rt_runtime_us
=$
(cgget
-nv -r cpu.rt_runtime_us
/)
51 cgset
-r cpu.rt_runtime_us
=$rt_runtime_us $defaultcgroup
55 # Classify everything to default cgroup. Ignore errors, some processes
56 # may exit after ps is run and before cgclassify moves them.
58 classify_all
-g $controllers:$defaultcgroup ||
:
62 cgclassify
"$@" $
(ps
--no-headers -eL o tid
) 2>/dev
/null
67 stat_busy
"Starting CGroups configuration"
68 /sbin
/cgconfigparser
-l /etc
/cgconfig.conf
72 if [ $CREATE_DEFAULT == "yes" ]; then
75 if [ $CLASSIFY == "yes" ]; then
83 stat_busy
"Clearing CGroups configuration"
98 echo "usage: $0 {start|stop|restart}"