diff -Nurp util-vserver-0.30.210.orig/scripts/vserver.functions util-vserver-0.30.210.cpuset/scripts/vserver.functions --- util-vserver-0.30.210.orig/scripts/vserver.functions 2006-01-22 13:24:25.000000000 +0100 +++ util-vserver-0.30.210.cpuset/scripts/vserver.functions 2006-04-13 01:36:34.000000000 +0200 @@ -690,6 +690,54 @@ function generateOptions fi } +function addtoCPUSET +{ + local vdir=$1 + local cpuset + local f="$vdir"/cpuset + local i + local configured=0 + + test -d "$f" || return 0 + test -e "$f"/name || return 0 + + read cpuset < "$f"/name + test -e "$f"/nocreate || { + test -d /dev/cpuset/"$cpuset" || mkdir /dev/cpuset/"$cpuset" || configured=1 + for i in cpus mems cpu_exclusive mem_exclusive virtualize; do + if test -e "$f"/"$i"; then + cat "$f"/"$i" >/dev/cpuset/"$cpuset"/"$i" 2>/dev/null || { + configured=1 + break + } + fi + done + } + + echo $$ >/dev/cpuset/"$cpuset"/tasks || configured=1 + if [ "$configured" -ne 0 ]; then + warning $"\ +WARNING: Failed to create or CPUSET \"$cpuset\" does not exist! Not using it!" >&2 + rmdir /dev/cpuset/"$cpuset" 2>/dev/null || : + return 0 + fi +} + +function removeCPUSET +{ + local vdir=$1 + local cpuset + local f="$vdir"/cpuset + + test -d "$f" || return 0 + test -e "$f"/name || return 0 + + read cpuset < "$f"/name + test -e "$f"/nocreate || { + rmdir /dev/cpuset/"$cpuset" 2>/dev/null || : + } +} + function _mountVserverInternal { local fstab="$1" diff -Nurp util-vserver-0.30.210.orig/scripts/vserver-setup.functions util-vserver-0.30.210.cpuset/scripts/vserver-setup.functions --- util-vserver-0.30.210.orig/scripts/vserver-setup.functions 2006-01-03 00:50:21.000000000 +0100 +++ util-vserver-0.30.210.cpuset/scripts/vserver-setup.functions 2006-04-13 01:39:08.000000000 +0200 @@ -24,11 +24,15 @@ SETUP_LOCKFILE= SETUP_CONFDIR= SETUP_CONTEXT= SETUP_INITSTYLE= +SETUP_CPUSET= +SETUP_CPUSETCPUS= +SETUP_CPUSETMEMS= +SETUP_CPUSETVIRT= declare -a SETUP_INTERFACES=() declare -a SETUP_FLAGS=() -declare -r SETUP_OPTIONS="confdir:,lockfile:,hostname:,netdev:,netmask:,netprefix:,netbcast:,interface:,flags:,context:,initstyle:" +declare -r SETUP_OPTIONS="confdir:,lockfile:,hostname:,netdev:,netmask:,netprefix:,netbcast:,interface:,flags:,context:,initstyle:,cpuset:,cpusetcpus:,cpusetmems:,cpusetvirt" declare -r SETUP_HELPMSG=$" --context ... the static context of the vserver [default: none; a dynamic context will be assumed] @@ -55,6 +59,19 @@ declare -r SETUP_HELPMSG=$" this becomes a per vserver limit) private: No other process can join this security context. Even root + --cpuset + ... declares the CPUSET this vserver will run in [default: none] + --cpusetcpus ]> + ... sets which cpus belong to the CPUSET, + exclusive is a flag (0|1) prohibiting any other cpuset from + using those cpus + --cpusetmems ]> + ... sets which memory pools belong to the CPUSET, + exclusive is a flag (0|1) prohibiting any other cpuset from + using those memory pools + --cpusetvirt + ... virtualize cpuset (guest will see only CPUs defined in cpuset) + Requires kernel patch from http://www.bullopensource.org/cpuset/ --initstyle