ia64/linux-2.6.18-xen.hg

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