ia64/linux-2.6.18-xen.hg

view arch/sparc/lib/memcmp.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 831230e53067
children
line source
1 .text
2 .align 4
3 .global __memcmp, memcmp
4 __memcmp:
5 memcmp:
6 #if 1
7 cmp %o2, 0
8 ble L3
9 mov 0, %g3
10 L5:
11 ldub [%o0], %g2
12 ldub [%o1], %g3
13 sub %g2, %g3, %g2
14 mov %g2, %g3
15 sll %g2, 24, %g2
17 cmp %g2, 0
18 bne L3
19 add %o0, 1, %o0
21 add %o2, -1, %o2
23 cmp %o2, 0
24 bg L5
25 add %o1, 1, %o1
26 L3:
27 sll %g3, 24, %o0
28 sra %o0, 24, %o0
30 retl
31 nop
32 #else
33 save %sp, -104, %sp
34 mov %i2, %o4
35 mov %i0, %o0
37 cmp %o4, 15
38 ble L72
39 mov %i1, %i2
41 andcc %i2, 3, %g0
42 be L161
43 andcc %o0, 3, %g2
44 L75:
45 ldub [%o0], %g3
46 ldub [%i2], %g2
47 add %o0,1, %o0
49 subcc %g3, %g2, %i0
50 bne L156
51 add %i2, 1, %i2
53 andcc %i2, 3, %g0
54 bne L75
55 add %o4, -1, %o4
57 andcc %o0, 3, %g2
58 L161:
59 bne,a L78
60 mov %i2, %i1
62 mov %o0, %i5
63 mov %i2, %i3
64 srl %o4, 2, %i4
66 cmp %i4, 0
67 bge L93
68 mov %i4, %g2
70 add %i4, 3, %g2
71 L93:
72 sra %g2, 2, %g2
73 sll %g2, 2, %g2
74 sub %i4, %g2, %g2
76 cmp %g2, 1
77 be,a L88
78 add %o0, 4, %i5
80 bg L94
81 cmp %g2, 2
83 cmp %g2, 0
84 be,a L86
85 ld [%o0], %g3
87 b L162
88 ld [%i5], %g3
89 L94:
90 be L81
91 cmp %g2, 3
93 be,a L83
94 add %o0, -4, %i5
96 b L162
97 ld [%i5], %g3
98 L81:
99 add %o0, -8, %i5
100 ld [%o0], %g3
101 add %i2, -8, %i3
102 ld [%i2], %g2
104 b L82
105 add %i4, 2, %i4
106 L83:
107 ld [%o0], %g4
108 add %i2, -4, %i3
109 ld [%i2], %g1
111 b L84
112 add %i4, 1, %i4
113 L86:
114 b L87
115 ld [%i2], %g2
116 L88:
117 add %i2, 4, %i3
118 ld [%o0], %g4
119 add %i4, -1, %i4
120 ld [%i2], %g1
121 L95:
122 ld [%i5], %g3
123 L162:
124 cmp %g4, %g1
125 be L87
126 ld [%i3], %g2
128 cmp %g4, %g1
129 L163:
130 bleu L114
131 mov -1, %i0
133 b L114
134 mov 1, %i0
135 L87:
136 ld [%i5 + 4], %g4
137 cmp %g3, %g2
138 bne L163
139 ld [%i3 + 4], %g1
140 L84:
141 ld [%i5 + 8], %g3
143 cmp %g4, %g1
144 bne L163
145 ld [%i3 + 8], %g2
146 L82:
147 ld [%i5 + 12], %g4
148 cmp %g3, %g2
149 bne L163
150 ld [%i3 + 12], %g1
152 add %i5, 16, %i5
154 addcc %i4, -4, %i4
155 bne L95
156 add %i3, 16, %i3
158 cmp %g4, %g1
159 bne L163
160 nop
162 b L114
163 mov 0, %i0
164 L78:
165 srl %o4, 2, %i0
166 and %o0, -4, %i3
167 orcc %i0, %g0, %g3
168 sll %g2, 3, %o7
169 mov 32, %g2
171 bge L129
172 sub %g2, %o7, %o1
174 add %i0, 3, %g3
175 L129:
176 sra %g3, 2, %g2
177 sll %g2, 2, %g2
178 sub %i0, %g2, %g2
180 cmp %g2, 1
181 be,a L124
182 ld [%i3], %o3
184 bg L130
185 cmp %g2, 2
187 cmp %g2, 0
188 be,a L122
189 ld [%i3], %o2
191 b L164
192 sll %o3, %o7, %g3
193 L130:
194 be L117
195 cmp %g2, 3
197 be,a L119
198 ld [%i3], %g1
200 b L164
201 sll %o3, %o7, %g3
202 L117:
203 ld [%i3], %g4
204 add %i2, -8, %i1
205 ld [%i3 + 4], %o3
206 add %i0, 2, %i0
207 ld [%i2], %i4
209 b L118
210 add %i3, -4, %i3
211 L119:
212 ld [%i3 + 4], %g4
213 add %i2, -4, %i1
214 ld [%i2], %i5
216 b L120
217 add %i0, 1, %i0
218 L122:
219 ld [%i3 + 4], %g1
220 ld [%i2], %i4
222 b L123
223 add %i3, 4, %i3
224 L124:
225 add %i2, 4, %i1
226 ld [%i3 + 4], %o2
227 add %i0, -1, %i0
228 ld [%i2], %i5
229 add %i3, 8, %i3
230 L131:
231 sll %o3, %o7, %g3
232 L164:
233 srl %o2, %o1, %g2
234 ld [%i3], %g1
235 or %g3, %g2, %g3
237 cmp %g3, %i5
238 bne L163
239 ld [%i1], %i4
240 L123:
241 sll %o2, %o7, %g3
242 srl %g1, %o1, %g2
243 ld [%i3 + 4], %g4
244 or %g3, %g2, %g3
246 cmp %g3, %i4
247 bne L163
248 ld [%i1 + 4], %i5
249 L120:
250 sll %g1, %o7, %g3
251 srl %g4, %o1, %g2
252 ld [%i3 + 8], %o3
253 or %g3, %g2, %g3
255 cmp %g3, %i5
256 bne L163
257 ld [%i1 + 8], %i4
258 L118:
259 sll %g4, %o7, %g3
260 srl %o3, %o1, %g2
261 ld [%i3 + 12], %o2
262 or %g3, %g2, %g3
264 cmp %g3, %i4
265 bne L163
266 ld [%i1 + 12], %i5
268 add %i3, 16, %i3
269 addcc %i0, -4, %i0
270 bne L131
271 add %i1, 16, %i1
273 sll %o3, %o7, %g3
274 srl %o2, %o1, %g2
275 or %g3, %g2, %g3
277 cmp %g3, %i5
278 be,a L114
279 mov 0, %i0
281 b,a L163
282 L114:
283 cmp %i0, 0
284 bne L156
285 and %o4, -4, %g2
287 add %o0, %g2, %o0
288 add %i2, %g2, %i2
289 and %o4, 3, %o4
290 L72:
291 cmp %o4, 0
292 be L156
293 mov 0, %i0
295 ldub [%o0], %g3
296 L165:
297 ldub [%i2], %g2
298 add %o0, 1, %o0
300 subcc %g3, %g2, %i0
301 bne L156
302 add %i2, 1, %i2
304 addcc %o4, -1, %o4
305 bne,a L165
306 ldub [%o0], %g3
308 mov 0, %i0
309 L156:
310 ret
311 restore
312 #endif