WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 1 of 3] CA-32810: prevent the memory ballooning daemon

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [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
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Fri, 27 Nov 2009 23:01:56 +0000
Delivery-date: Fri, 27 Nov 2009 15:02:57 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1259362915@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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 = 
0L
 
 let initial_reservation_path dom_path = dom_path ^ 
"/memory/initial-reservation"
 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
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>