ia64/linux-2.6.18-xen.hg

view arch/ia64/xen/xenpal.S @ 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 a533be77c572
children
line source
1 /*
2 * ia64/xen/xenpal.S
3 *
4 * Alternate PAL routines for Xen. Heavily leveraged from
5 * ia64/kernel/pal.S
6 *
7 * Copyright (C) 2005 Hewlett-Packard Co
8 * Dan Magenheimer <dan.magenheimer@.hp.com>
9 */
11 #include <asm/asmmacro.h>
12 #include <asm/processor.h>
14 GLOBAL_ENTRY(xen_pal_call_static)
15 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
16 alloc loc1 = ar.pfs,5,5,0,0
17 #ifdef CONFIG_XEN
18 movl r22=running_on_xen;;
19 ld4 r22=[r22];;
20 cmp.eq p7,p0=r22,r0
21 (p7) br.cond.spnt.many __ia64_pal_call_static;;
22 #endif
23 movl loc2 = pal_entry_point
24 1: {
25 mov r28 = in0
26 mov r29 = in1
27 mov r8 = ip
28 }
29 ;;
30 ld8 loc2 = [loc2] // loc2 <- entry point
31 tbit.nz p6,p7 = in4, 0
32 adds r8 = 1f-1b,r8
33 mov loc4=ar.rsc // save RSE configuration
34 ;;
35 mov ar.rsc=0 // put RSE in enforced lazy, LE mode
36 #ifdef CONFIG_XEN
37 mov r9 = r8
38 XEN_HYPER_GET_PSR
39 ;;
40 mov loc3 = r8
41 mov r8 = r9
42 ;;
43 #else
44 mov loc3 = psr
45 #endif
46 mov loc0 = rp
47 .body
48 mov r30 = in2
50 #ifdef CONFIG_XEN
51 // this is low priority for paravirtualization, but is called
52 // from the idle loop so confuses privop counting
53 movl r31=XSI_PSR_I_ADDR
54 ;;
55 ld8 r31=[r31]
56 mov r22=1
57 ;;
58 st1 [r31]=r22
59 ;;
60 (p6) movl r31=XSI_PSR_IC
61 ;;
62 (p6) st4.rel [r31]=r0
63 ;;
64 mov r31 = in3
65 mov b7 = loc2
66 ;;
67 #else
68 (p6) rsm psr.i | psr.ic
69 mov r31 = in3
70 mov b7 = loc2
72 (p7) rsm psr.i
73 ;;
74 (p6) srlz.i
75 #endif
76 mov rp = r8
77 br.cond.sptk.many b7
78 1: mov psr.l = loc3
79 mov ar.rsc = loc4 // restore RSE configuration
80 mov ar.pfs = loc1
81 mov rp = loc0
82 ;;
83 srlz.d // seralize restoration of psr.l
84 br.ret.sptk.many b0
85 END(xen_pal_call_static)