CGroups: fix group initialization

Make sure cpuset.cpus and cpuset.mems exist in the parent group before
attempting to copy them to the new group.
This commit is contained in:
William Hubbs 2011-11-18 08:32:06 -06:00
parent 62f4438376
commit a5ba2f3264

View File

@ -194,8 +194,11 @@ if [ -d /sys/fs/cgroup/ ]; then
# use RC_SVCNAME unless overridden in conf.d # use RC_SVCNAME unless overridden in conf.d
SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME} SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME}
mkdir -p /sys/fs/cgroup/${SVC_CGROUP} mkdir -p /sys/fs/cgroup/${SVC_CGROUP}
cp /sys/fs/cgroup/cpuset.cpus /sys/fs/cgroup/${SVC_CGROUP} for f in cpuset.cpus cpuset.mems; do
cp /sys/fs/cgroup/cpuset.mems /sys/fs/cgroup/${SVC_CGROUP} if [ -f /sys/fs/cgroup/${f} ]; then
cp /sys/fs/cgroup/${f} /sys/fs/cgroup/${SVC_CGROUP}
fi
done
# now attach self to cgroup - any children of this process will inherit this # now attach self to cgroup - any children of this process will inherit this
echo $$ > /sys/fs/cgroup/${SVC_CGROUP}/tasks echo $$ > /sys/fs/cgroup/${SVC_CGROUP}/tasks
# TODO: set res limits from conf.d # TODO: set res limits from conf.d