ia64/linux-2.6.18-xen.hg

view scripts/extract-ikconfig @ 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 831230e53067
children
line source
1 #!/bin/sh
2 # extracts .config info from a [b]zImage file
3 # uses: binoffset (new), dd, zcat, strings, grep
4 # $arg1 is [b]zImage filename
6 binoffset="./scripts/binoffset"
7 test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1
9 IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
10 IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
11 function dump_config {
12 typeset file="$1"
14 start=`$binoffset $file $IKCFG_ST 2>/dev/null`
15 [ "$?" != "0" ] && start="-1"
16 if [ "$start" -eq "-1" ]; then
17 return
18 fi
19 end=`$binoffset $file $IKCFG_ED 2>/dev/null`
21 let start="$start + 8"
22 let size="$end - $start"
24 dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
26 clean_up
27 exit 0
28 }
31 usage()
32 {
33 echo " usage: extract-ikconfig [b]zImage_filename"
34 }
36 clean_up()
37 {
38 if [ "$TMPFILE" != "" ]; then
39 rm -f $TMPFILE
40 fi
41 }
43 if [ $# -lt 1 ]
44 then
45 usage
46 exit 1
47 fi
49 TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1
50 image="$1"
52 # vmlinux: Attempt to dump the configuration from the file directly
53 dump_config "$image"
55 GZHDR1="0x1f 0x8b 0x08 0x00"
56 GZHDR2="0x1f 0x8b 0x08 0x08"
58 # vmlinux.gz: Check for a compressed images
59 off=`$binoffset "$image" $GZHDR1 2>/dev/null`
60 [ "$?" != "0" ] && off="-1"
61 if [ "$off" -eq "-1" ]; then
62 off=`$binoffset "$image" $GZHDR2 2>/dev/null`
63 [ "$?" != "0" ] && off="-1"
64 fi
65 if [ "$off" -eq "0" ]; then
66 zcat <"$image" >"$TMPFILE"
67 dump_config "$TMPFILE"
68 elif [ "$off" -ne "-1" ]; then
69 (dd ibs="$off" skip=1 count=0 && dd bs=512k) <"$image" 2>/dev/null | \
70 zcat >"$TMPFILE"
71 dump_config "$TMPFILE"
72 fi
74 echo "ERROR: Unable to extract kernel configuration information."
75 echo " This kernel image may not have the config info."
77 clean_up
78 exit 1