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

RE: [Xen-API] [PATCH 3 of 4] [XIU]: when a domain target is updated, transfer the memory immediately from the host, respecting both the domain's max_mem and the total amount of memory free on the host


  • To: "xen-api@xxxxxxxxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxxxxxxxx>
  • From: Dave Scott <Dave.Scott@xxxxxxxxxxxxx>
  • Date: Wed, 25 Nov 2009 10:26:32 +0000
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Delivery-date: Wed, 25 Nov 2009 02:26:32 -0800
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
  • Thread-index: AcptNGx2BQ3TVNQyTg6K/5DFh+gr+AAhRxog
  • Thread-topic: [Xen-API] [PATCH 3 of 4] [XIU]: when a domain target is updated, transfer the memory immediately from the host, respecting both the domain's max_mem and the total amount of memory free on the host

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
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

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