Skip to content

Commit 13f2494

Browse files
authored
CA-423816 avoid double counting VM overhead memory (#7005)
When we are using a known memory configuration it includes the overhead. So we only have to add it when we create a new configuration. Localhost migration in a loop before and after the patch, memory reported by list_domains -memory -bytes: Before: ``` id | uuid | state | tot bytes | max bytes | shadow bytes 17 | 8fc1ada1-... | B H | 4296003584 | 4336898048 | 36700160 18 | 8fc1ada1-... | B H | 4296003584 | 4376743936 | 36700160 19 | 8fc1ada1-... | B H | 4296003584 | 4416589824 | 36700160 20 | 8fc1ada1-... | B H | 4296003584 | 4456435712 | 36700160 21 | 8fc1ada1-... | B H | 4296003584 | 4496281600 | 36700160 22 | 8fc1ada1-... | B H | 4296003584 | 4536127488 | 36700160 23 | 8fc1ada1-... | B H | 4296003584 | 4575973376 | 36700160 24 | 8fc1ada1-... | B H | 4296003584 | 4615819264 | 36700160 25 | 8fc1ada1-... | B H | 4296003584 | 4655665152 | 36700160 26 | 8fc1ada1-... | B H | 4296003584 | 4695511040 | 36700160 ``` After: ``` id | uuid | state | tot bytes | max bytes | shadow bytes 27 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 28 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 29 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 30 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 31 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 32 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 33 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 34 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 35 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 36 | 8fc1ada1-... | B H | 4256157696 | 4297052160 | 36700160 ``` Based on work by Edwin Torok.
2 parents d7e57cb + 29955aa commit 13f2494

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

ocaml/quicktest/quicktest_vm_memory.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let check_tasks tasks =
1212
let one t ~host ~vm ~workload_vm n =
1313
Trace.with_ __FUNCTION__ @@ fun scope ->
1414
workload t ~host ~workload_vm ;
15-
let vms = fill_mem_n t ~workaround_migration:true ~host ~vm ~n in
15+
let vms = fill_mem_n t ~workaround_migration:false ~host ~vm ~n in
1616

1717
let migration_host, migration_vm = List.nth vms 0 in
1818

ocaml/xenopsd/xc/xenops_server_xen.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,13 +1852,16 @@ module VM = struct
18521852
"VM = %s; using memory_dynamic_min = %Ld and \
18531853
memory_dynamic_max = %Ld"
18541854
vm.Vm.id vm.memory_dynamic_min vm.memory_dynamic_max ;
1855-
(vm.memory_dynamic_min, vm.memory_dynamic_max, None)
1855+
( vm.memory_dynamic_min +++ overhead_bytes
1856+
, vm.memory_dynamic_max +++ overhead_bytes
1857+
, None
1858+
)
18561859
)
18571860
in
1858-
let min_kib = kib_of_bytes_used (min_bytes +++ overhead_bytes)
1861+
let min_kib = kib_of_bytes_used min_bytes
18591862
and memory_total_source_kib =
18601863
Option.map kib_of_bytes_used memory_total_source_bytes
1861-
and max_kib = kib_of_bytes_used (max_bytes +++ overhead_bytes) in
1864+
and max_kib = kib_of_bytes_used max_bytes in
18621865
(* XXX: we would like to be able to cancel an in-progress
18631866
with_reservation *)
18641867
let dbg = Xenops_task.get_dbg task in

0 commit comments

Comments
 (0)