]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- moved cpuset/cgroup mounting code into cpuset startup script
authorJan Rękorajski <baggins@pld-linux.org>
Thu, 10 Feb 2011 11:01:48 +0000 (11:01 +0000)
committerJan Rękorajski <baggins@pld-linux.org>
Thu, 10 Feb 2011 11:01:48 +0000 (11:01 +0000)
  for seamless interoperability with libcgroup

svn-id: @12128

rc.d/init.d/cpusets
rc.d/rc.sysinit

index 2a2ed48c4818a7b00a1f9c2704f783c9f550ec25..944173d0f938c26112c9bfaf3b46344ea79b6234 100755 (executable)
@@ -26,15 +26,31 @@ fi
 if grep -q "/dev/cgroup" /proc/mounts ; then
        CGDIR="/dev/cgroup"
        CSUBSYS="cpuset."
-else
+elif grep -q "/dev/cpuset" /proc/mounts ; then
        CGDIR="/dev/cpuset"
        CSUBSYS=""
 fi
 
-if is_yes "${CPUSETS}" && [ -z "${CGDIR}" ]; then
-       nls "ERROR: CGROUP/CPUSET support not enabled in kernel or /dev/cpuset or /dev/cgroup not mounted" >&2
-       exit 1
-fi
+cpuset_mount() {
+       [ -n "${CGDIR}" ] && return
+
+       if grep -q cgroup /proc/filesystems 2>/dev/null ; then
+               if ! grep -q "^[^#].*cgroup" /etc/fstab 2>/dev/null ; then
+                       # creating is more convenient than artificial conflict with older udev
+                       mkdir -p /dev/cgroup
+                       modprobe -s blk-cgroup 2>/dev/null
+                       # mount w/o options enables all available cgroup subsystems
+                       mount -n -t cgroup none /dev/cgroup
+               fi
+       elif grep -q cpuset /proc/filesystems 2>/dev/null ; then
+               if ! grep -q "^[^#].*cpuset" /etc/fstab 2>/dev/null ; then
+                       mount -n -t cpuset none /dev/cpuset
+               fi
+       else
+               nls "ERROR: CGROUP/CPUSET support not enabled in kernel" >&2
+               return 1
+       fi
+}
 
 cpuset_create() {
        local CPUS MEMS CPU_EXCLUSIVE MEM_EXCLUSIVE NOTIFY_ON_RELEASE TASKS
@@ -137,6 +153,7 @@ cpusets_boot=$(
 # See how we were called.
 case "$1" in
   start)
+       cpuset_mount
        start
        ;;
   stop)
@@ -163,6 +180,7 @@ case "$1" in
        ;;
   restart)
        stop
+       cpuset_mount
        start
        ;;
   *)
index 4a7b960b95aa79be4e7c1dc64e444052e114ca73..0703c912b26cce9b6690f9b1f81ba5f4f5a474af 100755 (executable)
@@ -270,21 +270,6 @@ if ! is_yes "$VSERVER"; then
                /sbin/blogd
        fi
 
-       # cgroup/cpuset support
-       if grep -q cgroup /proc/filesystems 2>/dev/null ; then
-               if ! grep -q "^[^#].*cgroup" /etc/fstab 2>/dev/null ; then
-                       # creating is more convenient than artificial conflict with older udev
-                       mkdir -p /dev/cgroup
-                       # mount w/o options enables all available cgroup subsystems
-                       modprobe -s blk-cgroup 2> /dev/null
-                       mount -n -t cgroup none /dev/cgroup
-               fi
-       elif grep -q cpuset /proc/filesystems 2>/dev/null ; then
-               if ! grep -q "^[^#].*cpuset" /etc/fstab 2>/dev/null ; then
-                       mount -n -t cpuset none /dev/cpuset
-               fi
-       fi
-
        # Configure Linux kernel (initial configuration, some required modules still
        # may be missing).
        sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
@@ -484,12 +469,6 @@ if ! is_yes "$VSERVER"; then
                mount -f -t selinuxfs selinuxfs /selinux
        fi
 
-       if is_fsmounted cgroup /dev/cgroup; then
-               mount -f -t cgroup none /dev/cgroup
-       elif is_fsmounted cpuset /dev/cpuset; then
-               mount -f -t cpuset none /dev/cpuset
-       fi
-       
        emit --no-wait root-filesystem
        emit --no-wait virtual-filesystems
 
This page took 0.142165 seconds and 4 git commands to generate.