[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH] [CA-41286] Fixes a memory accounting error in the squeezing code
# HG changeset patch # User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx> # Date 1274266211 -3600 # Node ID 9d1433fc3d5e2f9b449b4026c3fd3cbe60e08b8b # Parent 282bf26c12147e28cf8c95562e8dbc3c85cf056f [CA-41286] Fixes a memory accounting error in the squeezing code. When calculating an upper bound for the memory usage of an HVM domain with no balloon driver, the squeezing code would double-count (inappropriately) the shadow memory area. This caused the squeezing algorithm to underestimate the amount of usable memory of any host running one or more HVM domains without balloon drivers. This change removes the double-counting error, and also fixes a bug that caused the squeezer to add (inappropriately) the shadow memory size to Xen maxmem. Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx> Acked-by: Dave Scott <dave.scott@xxxxxxxxxxxxx> diff -r 282bf26c1214 -r 9d1433fc3d5e ocaml/xenops/squeeze_xen.ml --- a/ocaml/xenops/squeeze_xen.ml Tue May 18 15:10:52 2010 +0100 +++ b/ocaml/xenops/squeeze_xen.ml Wed May 19 11:50:11 2010 +0100 @@ -262,6 +262,12 @@ (fun di -> try let memory_actual_kib = Xc.pages_to_kib (Int64.of_nativeint di.Xc.total_memory_pages) in + let memory_shadow_kib = + if di.Xc.hvm_guest then + try + Memory.kib_of_mib (Int64.of_int (Xc.shadow_allocation_get xc di.Xc.domid)) + with _ -> 0L + else 0L in (* dom0 is special for some reason *) let memory_max_kib = if di.Xc.domid = 0 then 0L else Xc.pages_to_kib (Int64.of_nativeint di.Xc.max_memory_pages) in (* Misc other stuff appears in max_memory_pages *) @@ -308,18 +314,15 @@ "initial-reservation". *) if not can_balloon then begin let initial_reservation_kib = Domain.get_initial_reservation cnx di.Xc.domid 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 - memory *) - let unaccounted_kib = max 0L (Int64.sub initial_reservation_kib memory_actual_kib) in + let unaccounted_kib = max 0L + (initial_reservation_kib -* memory_actual_kib -* memory_shadow_kib) in reserved_kib := Int64.add !reserved_kib unaccounted_kib; - [ { domain with Squeeze. - dynamic_min_kib = initial_reservation_kib; - dynamic_max_kib = initial_reservation_kib; - target_kib = initial_reservation_kib; - memory_actual_kib = max memory_actual_kib initial_reservation_kib; - } ] + dynamic_min_kib = memory_max_kib; + dynamic_max_kib = memory_max_kib; + target_kib = memory_max_kib; + memory_actual_kib = memory_max_kib; + } ] end else begin let target_kib = Domain.get_target cnx di.Xc.domid in 1 file changed, 13 insertions(+), 10 deletions(-) ocaml/xenops/squeeze_xen.ml | 23 +++++++++++++---------- Attachment:
xen-api.hg.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |