From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, sh/
Date: Sat, 19 Nov 2011 00:05:51 +0000 (UTC) [thread overview]
Message-ID: <0510c473d4cd9097401e3a7bc236b0121977b81d.WilliamH@gentoo> (raw)
commit: 0510c473d4cd9097401e3a7bc236b0121977b81d
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 18 21:54:18 2011 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Nov 18 23:58:37 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=0510c473
CGroups: /sys/fs/cgroups should be a tmpfs
The kernel documentation states that a cgroup file system should not be
mounted here, but a tmpfs.
This also means that we should not create a group for each process, but
we should allow the user to specify which group a process should be
assigned to. The rc_cgroup variable will be used for this purpose.
For more information, see /usr/src/linux/Documentation/cgroups/cgroups.txt.
---
init.d/sysfs.in | 2 +-
sh/runscript.sh.in | 29 +++++++----------------------
2 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/init.d/sysfs.in b/init.d/sysfs.in
index 257f314..a536d5f 100644
--- a/init.d/sysfs.in
+++ b/init.d/sysfs.in
@@ -65,7 +65,7 @@ mount_misc()
if [ -d /sys/fs/cgroup ] && ! mountinfo -q /sys/fs/cgroup; then
if grep -qs cgroup /proc/filesystems; then
ebegin "Mounting cgroup filesystem"
- mount -n -t cgroup -o nodev,noexec,nosuid \
+ mount -n -t tmpfs -o nodev,noexec,nosuid \
cgroup /sys/fs/cgroup
eend $?
fi
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index c7d712b..706a1f7 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -190,18 +190,13 @@ fi
sourcex -e "@SYSCONFDIR@/rc.conf"
# Attach to CGroup - dir existing is enough for us
-if [ -d /sys/fs/cgroup/ ]; then
- # use RC_SVCNAME unless overridden in conf.d
- SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME}
- mkdir -p /sys/fs/cgroup/${SVC_CGROUP}
- for f in cpuset.cpus cpuset.mems; do
- 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
- echo $$ > /sys/fs/cgroup/${SVC_CGROUP}/tasks
- # TODO: set res limits from conf.d
+if [ -d /sys/fs/cgroup -a -n "${rc_cgroup}" ]; then
+ if [ -d /sys/fs/cgroup/${rc_cgroup} ]; then
+ # attach self to cgroup - any children of this process will inherit this
+ echo $$ > /sys/fs/cgroup/${rc_cgroup}/tasks
+ else
+ eerror "Control group /sys/fs/cgroup/${rc_cgroup} does not exist."
+ fi
fi
# Apply any ulimit defined
@@ -307,14 +302,4 @@ while [ -n "$1" ]; do
exit 1
done
-# CGroup cleanup
-if [ -d /sys/fs/cgroup/ ]; then
- # use RC_SVCNAME unless overridden in conf.d
- SVC_CGROUP=${rc_cgroup:-$RC_SVCNAME}
- # reattach to root cgroup
- echo $$ > /sys/fs/cgroup/tasks
- # remove cgroup if empty, will fail if any task attached
- rmdir /sys/fs/cgroup/${SVC_CGROUP} 2>/dev/null
-fi
-
exit 0
next reply other threads:[~2011-11-19 0:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-19 0:05 William Hubbs [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-04-03 18:05 [gentoo-commits] proj/openrc:master commit in: init.d/, sh/ William Hubbs
2013-02-17 2:49 William Hubbs
2012-02-20 23:11 William Hubbs
2012-01-28 18:32 Christian Ruppert
2012-01-22 18:00 William Hubbs
2011-12-20 4:01 William Hubbs
2011-10-16 23:02 Mike Frysinger
2011-07-05 23:42 William Hubbs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0510c473d4cd9097401e3a7bc236b0121977b81d.WilliamH@gentoo \
--to=williamh@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox