ia64/linux-2.6.18-xen.hg

view buildconfigs/create_config.sh @ 897:329ea0ccb344

balloon: try harder to balloon up under memory pressure.

Currently if the balloon driver is unable to increase the guest's
reservation it assumes the failure was due to reaching its full
allocation, gives up on the ballooning operation and records the limit
it reached as the "hard limit". The driver will not try again until
the target is set again (even to the same value).

However it is possible that ballooning has in fact failed due to
memory pressure in the host and therefore it is desirable to keep
attempting to reach the target in case memory becomes available. The
most likely scenario is that some guests are ballooning down while
others are ballooning up and therefore there is temporary memory
pressure while things stabilise. You would not expect a well behaved
toolstack to ask a domain to balloon to more than its allocation nor
would you expect it to deliberately over-commit memory by setting
balloon targets which exceed the total host memory.

This patch drops the concept of a hard limit and causes the balloon
driver to retry increasing the reservation on a timer in the same
manner as when decreasing the reservation.

Also if we partially succeed in increasing the reservation
(i.e. receive less pages than we asked for) then we may as well keep
those pages rather than returning them to Xen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 14:01:20 2009 +0100 (2009-06-05)
parents 28b48e63eba6
children
line source
1 #!/bin/sh
2 set -e
5 # Parse arguments
6 #
7 if [ $# -lt 1 -o $# -gt 4 ]; then
8 echo "Usage: $0 config-file EXTRAVERSION XEN_TARGET_ARCH XEN_SYSTYPE"
9 exit 1
10 fi
12 config_file=$1
13 extraversion=$2
14 target_arch=$3
15 systype=$4
18 # Start with initial config skeleton file, if any.
19 # Derive from linux-defconfig_xen_x86_32 otherwise.
20 #
21 skeleton=buildconfigs/linux-defconfig_${extraversion#-}_${target_arch}${systype}
22 [ -r $skeleton ] || skeleton=buildconfigs/linux-defconfig_xen_x86_32
23 [ -r $skeleton.local ] && skeleton=$skeleton.local
24 cp $skeleton $config_file
26 echo "Using $skeleton as base config"
28 # Update
29 #
30 filter_template="s/^#\{0,1\} *\(CONFIG[^= ]*\).*/\/^#\\\{0,1\\\} *\1[= ].*\/d/p"
31 config_dirs="buildconfigs/conf.linux buildconfigs/conf.linux-${target_arch} buildconfigs/conf.linux${extraversion} buildconfigs/conf.linux-${target_arch}${extraversion}"
33 for config_dir in $config_dirs
34 do
35 if [ -d $config_dir ]; then
36 echo "Processing $config_dir..." 1>&2
37 # processing is done in alphanumeric order
38 find $config_dir -type f | sort | while read update
39 do
40 echo " ... $update" 1>&2
41 # create the filter rules in a temp file
42 filter_rules=`mktemp -t xenupdateconf.XXXXXXXXXX`
43 sed -n "${filter_template}" < $update > $filter_rules
45 # filter the config file in place, removing any options that
46 # will be updated.
47 sed -f $filter_rules -i $config_file
48 cat $update >> $config_file
50 # clean up
51 rm -f $filter_rules
52 done
53 fi
54 done