ia64/linux-2.6.18-xen.hg

view arch/ia64/xen/hypercall.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 71a415f9179b
children
line source
1 /*
2 * Support routines for Xen hypercalls
3 *
4 * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
5 */
7 #include <asm/asmmacro.h>
8 #include <asm/intrinsics.h>
10 #ifdef __INTEL_COMPILER
11 # undef ASM_SUPPORTED
12 #else
13 # define ASM_SUPPORTED
14 #endif
16 #ifndef ASM_SUPPORTED
17 GLOBAL_ENTRY(xen_get_psr)
18 XEN_HYPER_GET_PSR
19 br.ret.sptk.many rp
20 ;;
21 END(xen_get_psr)
23 GLOBAL_ENTRY(xen_get_ivr)
24 XEN_HYPER_GET_IVR
25 br.ret.sptk.many rp
26 ;;
27 END(xen_get_ivr)
29 GLOBAL_ENTRY(xen_get_tpr)
30 XEN_HYPER_GET_TPR
31 br.ret.sptk.many rp
32 ;;
33 END(xen_get_tpr)
35 GLOBAL_ENTRY(xen_set_tpr)
36 mov r8=r32
37 XEN_HYPER_SET_TPR
38 br.ret.sptk.many rp
39 ;;
40 END(xen_set_tpr)
42 GLOBAL_ENTRY(xen_eoi)
43 mov r8=r32
44 XEN_HYPER_EOI
45 br.ret.sptk.many rp
46 ;;
47 END(xen_eoi)
49 GLOBAL_ENTRY(xen_thash)
50 mov r8=r32
51 XEN_HYPER_THASH
52 br.ret.sptk.many rp
53 ;;
54 END(xen_thash)
56 GLOBAL_ENTRY(xen_set_itm)
57 mov r8=r32
58 XEN_HYPER_SET_ITM
59 br.ret.sptk.many rp
60 ;;
61 END(xen_set_itm)
63 GLOBAL_ENTRY(xen_ptcga)
64 mov r8=r32
65 mov r9=r33
66 XEN_HYPER_PTC_GA
67 br.ret.sptk.many rp
68 ;;
69 END(xen_ptcga)
71 GLOBAL_ENTRY(xen_get_rr)
72 mov r8=r32
73 XEN_HYPER_GET_RR
74 br.ret.sptk.many rp
75 ;;
76 END(xen_get_rr)
78 GLOBAL_ENTRY(xen_set_rr)
79 mov r8=r32
80 mov r9=r33
81 XEN_HYPER_SET_RR
82 br.ret.sptk.many rp
83 ;;
84 END(xen_set_rr)
86 GLOBAL_ENTRY(xen_set_kr)
87 mov r8=r32
88 mov r9=r33
89 XEN_HYPER_SET_KR
90 br.ret.sptk.many rp
91 END(xen_set_kr)
93 GLOBAL_ENTRY(xen_fc)
94 mov r8=r32
95 XEN_HYPER_FC
96 br.ret.sptk.many rp
97 END(xen_fc)
99 GLOBAL_ENTRY(xen_get_cpuid)
100 mov r8=r32
101 XEN_HYPER_GET_CPUID
102 br.ret.sptk.many rp
103 END(xen_get_cpuid)
105 GLOBAL_ENTRY(xen_get_pmd)
106 mov r8=r32
107 XEN_HYPER_GET_PMD
108 br.ret.sptk.many rp
109 END(xen_get_pmd)
111 #ifdef CONFIG_IA32_SUPPORT
112 GLOBAL_ENTRY(xen_get_eflag)
113 XEN_HYPER_GET_EFLAG
114 br.ret.sptk.many rp
115 END(xen_get_eflag)
117 // some bits aren't set if pl!=0, see SDM vol1 3.1.8
118 GLOBAL_ENTRY(xen_set_eflag)
119 mov r8=r32
120 XEN_HYPER_SET_EFLAG
121 br.ret.sptk.many rp
122 END(xen_set_eflag)
123 #endif /* CONFIG_IA32_SUPPORT */
124 #endif /* ASM_SUPPORTED */
126 GLOBAL_ENTRY(xen_send_ipi)
127 mov r14=r32
128 mov r15=r33
129 mov r2=0x400
130 break 0x1000
131 ;;
132 br.ret.sptk.many rp
133 ;;
134 END(xen_send_ipi)
136 GLOBAL_ENTRY(__hypercall)
137 mov r2=r37
138 break 0x1000
139 br.ret.sptk.many b0
140 ;;
141 END(__hypercall)