From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RRYRV-00081d-6i for garchives@archives.gentoo.org; Sat, 19 Nov 2011 00:06:01 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DD3A421C139; Sat, 19 Nov 2011 00:05:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B28CA21C139 for ; Sat, 19 Nov 2011 00:05:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A3611B4025 for ; Sat, 19 Nov 2011 00:05:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 3AD3380042 for ; Sat, 19 Nov 2011 00:05:51 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <0510c473d4cd9097401e3a7bc236b0121977b81d.WilliamH@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, sh/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/sysfs.in sh/runscript.sh.in X-VCS-Directories: init.d/ sh/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 0510c473d4cd9097401e3a7bc236b0121977b81d Date: Sat, 19 Nov 2011 00:05:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: a5875092-d44a-4320-903b-33d640b9e6af X-Archives-Hash: 2d87414d74b742ec06ac269711ec828a commit: 0510c473d4cd9097401e3a7bc236b0121977b81d Author: William Hubbs gentoo org> AuthorDate: Fri Nov 18 21:54:18 2011 +0000 Commit: William Hubbs gentoo org> CommitDate: Fri Nov 18 23:58:37 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D0510c473 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.tx= t. --- 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" =20 # 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=3D${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 th= is + echo $$ > /sys/fs/cgroup/${rc_cgroup}/tasks + else + eerror "Control group /sys/fs/cgroup/${rc_cgroup} does not exist." + fi fi =20 # Apply any ulimit defined @@ -307,14 +302,4 @@ while [ -n "$1" ]; do exit 1 done =20 -# CGroup cleanup -if [ -d /sys/fs/cgroup/ ]; then - # use RC_SVCNAME unless overridden in conf.d - SVC_CGROUP=3D${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