[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 1 of 3] CA-32810: prevent the memory ballooning daemon capping a domain's memory usage before it has written feature-balloon

# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1259362816 0
# Node ID a42ee172122fcfb19efe8fd406ba3c84a120708c
# Parent  4985d668283114620078ad440b71081a22fa0e6d
CA-32810: prevent the memory ballooning daemon capping a domain's memory usage 
before it has written feature-balloon.

Initially the ballooning daemon treated all domains which had not yet started 
running as using their "initial-reservation". This relied on the assumption 
that the initial memory target would be reached by running the domain builder. 
This assumption is false because some memory accounted to the domain in 
totpages (eg VGA frame buffer) is allocated dynamically after unpause.

Instead we now consider all domains which have not yet written 
"feature-balloon" to be using the max of "initial-reservation" and totpages. 
This relies on the new, much weaker, assumption that, by the time 
"feature-balloon" is written, all memory allocations have ceased. Note that we 
never change a balloon target until "feature-balloon" is written so the domain 
will still have target=startmem at this point.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 4985d6682831 -r a42ee172122f ocaml/xenops/squeeze_xen.ml
--- a/ocaml/xenops/squeeze_xen.ml       Fri Nov 27 22:44:53 2009 +0000
+++ b/ocaml/xenops/squeeze_xen.ml       Fri Nov 27 23:00:16 2009 +0000
@@ -24,10 +24,6 @@
 module M = Debug.Debugger(struct let name = "memory" end)
 let debug = Squeeze.debug
 let error = Squeeze.error 
-(** We define a domain which is paused, not shutdown and has not clocked up 
any CPU cycles
-    as 'never_been_run' *)
-let never_been_run di = di.Xc.paused && not di.Xc.shutdown && di.Xc.cpu_time = 
 let initial_reservation_path dom_path = dom_path ^ 
 let target_path              dom_path = dom_path ^ "/memory/target"
@@ -219,7 +215,9 @@
                                           then we'll need to consider the 
domain's "initial-reservation". Note that the other fields
                                           won't necessarily have been created 
yet. *)
-                                       if never_been_run di then begin
+                                       (* If the domain has yet to expose it's 
feature-balloon flag then we assume it is using at least its
+                                          "initial-reservation". *)
+                                       if not can_balloon then begin
                                                let initial_reservation_kib = 
Int64.of_string (xs_read xs (initial_reservation_path path)) in
                                                (* memory_actual_kib is memory 
which xen has accounted to this domain. We bump this up to
                                                   the "initial-reservation" 
and compute how much memory to subtract from the host's free
1 file changed, 3 insertions(+), 5 deletions(-)
ocaml/xenops/squeeze_xen.ml |    8 +++-----

Attachment: xen-api.hg-3.patch
Description: Text Data

xen-api mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.