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

Re: [Xen-devel] freemem-slack and large memory environments

(Sorry for the delayed response, dealing with ENOTIME.)

On Thursday, February 26, 2015 05:47:21 PM Ian Campbell wrote:
> On Thu, 2015-02-26 at 10:38 -0700, Mike Latimer wrote:
> >    rc = libxl_set_memory_target(ctx, 0, free_memkb - need_memkb, 1, 0);
> I think so. In essence we just need to update need_memkb on each
> iteration, right?

Not quite...  need_memkb is used in the loop to determine if we have enough 
free memory for the new domain. So, need_memkb should always remain set to the 
total amount of memory requested - not just the amount of change still 

The easiest thing to do is set the dom0's memory target before the loop, which 
is what my original patch did.

Another approach would be something like this:

    uint32_t dom0_memkb, dom0_targetkb, pending_memkb;

    libxl_get_memory(ctx, 0, &dom0_memkb);   <--doesn't actually exist

    libxl_get_memory_target(ctx, 0, &dom0_targetkb);

    pending_memkb = (free_memkb + (dom0_memkb - dom0_targetkb));

    if (pending_memkb < need_memkb) {
        libxl_set_memory_target(ctx, 0, pending_memkb - need_memkb, 1, 0);

which essentially sets pending_memkb to the amount of free memory plus the 
amount of memory which will be freed once dom0 hits the its target.

The final possibility I can think of is to ensure libxl_wait_for_memory_target 
does not return until the memory target has been reached. That raises some 
concern about what happens if the target cannot be reached though...


Xen-devel mailing list



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