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

Re: [Xen-devel] [PATCH v3] libxl: Wait for ballooning if free memory is increasing



On Thursday, February 05, 2015 12:45:53 PM Ian Campbell wrote:
> On Mon, 2015-02-02 at 08:17 -0700, Mike Latimer wrote:
> > On Monday, February 02, 2015 02:35:39 PM Ian Campbell wrote:
> > > On Fri, 2015-01-30 at 14:01 -0700, Mike Latimer wrote:
> > > > During domain startup, all required memory ballooning must complete
> > > > within a maximum window of 33 seconds (3 retries, 11 seconds of
> > > > delay).
> > > > If not, domain creation is aborted with a 'failed to free memory'
> > > > error.
...
> Thanks, applied.

Unfortunately, I just found an issue with this codepath...

In tools/libxl/xl_cmdimpl.c:freemem, the following call sets the memory target 
for dom0:

  rc = libxl_set_memory_target(ctx, 0, free_memkb - need_memkb, 1, 0);

This reduces the memory target of dom0 by the amount of memory still needed - 
relative to the amount of memory currently free. In other words, during each 
iteration of the loop, dom0's target memory is set lower, and lower, and 
lower...

Prior to my changes, this issue would only be noticed when starting very large 
domains - due to the loop being limited to 3 iterations. (For example, when 
ballooning 512G, dom0 memory could be reduced up to 1.5T.) With my changes, 
this loop can take several more iterations (10 or many more in testing). With 
each iteration lowering dom0's target, the end result can be dom0 ballooning 
down 100's of gigabytes, just to satisfy a much smaller request. (On one 
machine, a 64G guest can result in dom0 ballooning down 500G.)

It seems like a proper fix would be to use libxl_get_memory_target to first 
check dom0's target and see if:

  (free_memory + (dom0_current_mem - dom0_target_mem)) >= needed_memory

If so, there will be sufficient memory when dom0 reaches the target, so don't 
change it. Before going down that road, I'd like a sanity check on that 
theory, and any advice on the overall picture (including my thread on freemem-
slack).

I'll leave it up to you if my patch should be reverted until a new patch is 
created.

Thanks!
Mike

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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