Reviewing my own patch: 

> diff -r 25cea9ab5619 -r 3c4e4f662084 ocaml/xiu/xiu.ml
> --- a/ocaml/xiu/xiu.ml        Tue Nov 24 18:24:59 2009 +0000
> +++ b/ocaml/xiu/xiu.ml        Tue Nov 24 18:25:00 2009 +0000
> @@ -152,14 +152,31 @@
>       try Hashtbl.find domains domid
>       with Not_found -> raise Domain_not_found
> 
> +let round_down_to_page x = (x / 4) * 4
> +
> +(** Add up to [delta_kib] memory to the domain, reducing the host free
> +memory by the same amount *) let transfer_to_domain dom delta_kib =
> +  let available_kib = min !physical_free_kib delta_kib in
> +  eprintf "(XIU) transfer_to_domain domid = %d; delta_kib = %d\n%!"
> +dom.domid delta_kib;
> +  dom.tot_mem_kib <- dom.tot_mem_kib + available_kib;
> +  physical_free_kib := !physical_free_kib - available_kib
> +

We obviously need a mutex to protect 'physical_free_kib' since xiu is actually 
multithreaded (one thread per simulated domain)

Cheers,
Dave


_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to