cgroups: mount cgroups suggested by the kernel documentation
The linux kernel documentation suggests mounting a separate cgroup hierarchy for each subsystem you want to control/monitor. This changes the cgroups mounting code to do this.
This commit is contained in:
parent
879e1acd5d
commit
461c69acdb
@ -60,27 +60,36 @@ mount_misc()
|
|||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Setup Kernel Support for cgroup
|
mount_cgroups()
|
||||||
if [ -d /sys/fs/cgroup ]; then
|
{
|
||||||
if grep -qs cgroup /proc/filesystems && \
|
if [ ! -e /proc/cgroups ]; then
|
||||||
! mountinfo -q /sys/fs/cgroup; then
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup; then
|
||||||
|
if grep -qs cgroup /proc/filesystems; then
|
||||||
ebegin "Mounting cgroup filesystem"
|
ebegin "Mounting cgroup filesystem"
|
||||||
mount -n -t tmpfs -o nodev,noexec,nosuid \
|
mount -n -t tmpfs -o nodev,noexec,nosuid,mode=755 \
|
||||||
cgroup /sys/fs/cgroup
|
cgroup_root /sys/fs/cgroup
|
||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
if ! mountinfo -q /sys/fs/cgroup/openrc; then
|
|
||||||
ebegin "creating openrc control group"
|
|
||||||
mkdir /sys/fs/cgroup/openrc
|
|
||||||
mount -n -t cgroup -o nodev,noexec,nosuid \
|
|
||||||
openrc /sys/fs/cgroup/openrc
|
|
||||||
echo 1 > /sys/fs/cgroup/openrc/notify_on_release
|
|
||||||
echo @LIBEXECDIR@/sh/cgroup-release-agent.sh \
|
|
||||||
> /sys/fs/cgroup/openrc/release_agent
|
|
||||||
eend
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
while read name hier groups enabled rest; do
|
||||||
|
case "${enabled}" in
|
||||||
|
1) mkdir /sys/fs/cgroup/${name}
|
||||||
|
mount -t cgroup -o nodev,noexec,nosuid,${name} \
|
||||||
|
${name} /sys/fs/cgroup/${name}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < /proc/cgroups
|
||||||
|
|
||||||
|
# mkdir /sys/fs/cgroup/openrc
|
||||||
|
# mount -t cgroup \
|
||||||
|
# -o nodev,noexec,nosuid,name=openrc \
|
||||||
|
# openrc /sys/fs/cgroup/openrc
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
@ -90,6 +99,11 @@ start()
|
|||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -eq 0 ]; then
|
if [ $retval -eq 0 ]; then
|
||||||
mount_misc
|
mount_misc
|
||||||
|
retval=$?
|
||||||
|
fi
|
||||||
|
if [ $retval -eq 0 ]; then
|
||||||
|
mount_cgroups
|
||||||
|
retval=$?
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user