From 7751466c148d6f751c60b1b0f06b604840da13de Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Sat, 13 Oct 2007 14:17:48 +0000 Subject: [PATCH] Add support for the OOM bias in the configuration. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2620 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- doc/configuration.xml | 5 +++++ scripts/vserver.functions | 37 +++++++++++++++++++++++++------------ scripts/vserver.start | 1 + 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/doc/configuration.xml b/doc/configuration.xml index 5702e5c..474b4ce 100644 --- a/doc/configuration.xml +++ b/doc/configuration.xml @@ -666,6 +666,11 @@ called as chbind <options> mount .... See fstab also. + + +Contains the bias to be applied to processes in this guest when the OOM-killer strikes. + + diff --git a/scripts/vserver.functions b/scripts/vserver.functions index 776e487..0eab27e 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -45,6 +45,7 @@ declare -a OPTS_VSCHED=() declare -a OPTS_ENV=() declare -a OPTS_VTAG_CREATE=() declare -a OPTS_VTAG_ENTER=() +declare -a OPTS_VMEMCTRL=() declare -a STOPCMD_PREPARE=() @@ -606,18 +607,6 @@ function _generateInterfaceOptions _HAVE_INTERFACE_OPTIONS=1 } -function _generateTagOptions -{ - local vdir="$1" - local tag - - getFileValue tag "$vdir/tag" "$vdir/context" - test -n "$tag" || return 0 - - OPTS_VTAG_CREATE=( --tag "$tag" ) - OPTS_VTAG_ENTER=( --tag "$tag" ) -} - function enableInterfaces { local i=0 @@ -688,6 +677,29 @@ function disableInterfaces unlock 1 } +function _generateTagOptions +{ + local vdir="$1" + local tag + + getFileValue tag "$vdir/tag" "$vdir/context" + test -n "$tag" || return 0 + + OPTS_VTAG_CREATE=( --tag "$tag" ) + OPTS_VTAG_ENTER=( --tag "$tag" ) +} + +function _generateMemctrlOptions +{ + local vdir="$" + local badness + + getFileValue badness "$vdir/badness" + test -n "$badness" || return 0 + + OPTS_VMEMCTRL=( --badness "$badness" ) +} + ## Usage: prepareInit function prepareInit { @@ -732,6 +744,7 @@ function generateOptions _generateScheduleOptions "$1" _generatePersonalityOptions "$1" _generateTagOptions "$1" + _generateMemctrlOptions "$1" if test -n "$_IS_FAKEINIT"; then CHCONTEXT_INIT_OPTS=( --disconnect --flag fakeinit ) diff --git a/scripts/vserver.start b/scripts/vserver.start index 1656df0..3d32363 100644 --- a/scripts/vserver.start +++ b/scripts/vserver.start @@ -142,6 +142,7 @@ if $_VSERVER_INFO - FEATURE migrate; then $_VSCHED --xid self --force "${OPTS_VSCHED[@]}" -- \ $_VSYSCTL --xid self --dir "$VSERVER_DIR"/sysctl --missingok -- \ $_VUNAME --xid self --dir "$VSERVER_DIR"/uts --missingok -- \ + $_VMEMCTRL --xid self "${OPTS_VMEMCTRL[@]}" -- \ "${VSERVER_EXTRA_CMDS[@]}" \ $_VUNAME --xid self --set -t context="$VSERVER_DIR" -- \ $_VATTRIBUTE --set "${OPTS_VATTRIBUTE[@]}" -- \ -- 1.8.1.5