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

Re: [Xen-devel] xl only waits 33 seconds for ballooning to complete



On Wednesday, January 07, 2015 09:38:31 AM Ian Campbell wrote:
> That's exactly what I was about to suggest as I read the penultimate
> paragraph, i.e. keep waiting so long as some reasonable delta occurs on
> each iteration.

Thanks, Ian.

I wonder if there is a future-safe threshold on the amount of delta that 
indicates progress is being made. Should some minimum safe progress amount or 
percentage be set, or is it better to just make sure free memory is increasing 
at the end of each iteration of the loop?

For example, the following simple change just tracks free_memkb and only 
decrements the retry count if it has not increased since the last check:

----------------------
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index ed0d478..4cf2991 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2196,7 +2196,7 @@ static int preserve_domain(uint32_t *r_domid, 
libxl_event *event,
 static int freemem(uint32_t domid, libxl_domain_build_info *b_info)
 {
     int rc, retries = 3;
-    uint32_t need_memkb, free_memkb;
+    uint32_t need_memkb, free_memkb, free_memkb_prev = 0;

     if (!autoballoon)
         return 0;
@@ -2229,7 +2229,10 @@ static int freemem(uint32_t domid, 
libxl_domain_build_info *b_info)
         if (rc < 0)
             return rc;

-        retries--;
+        /* only decrement retry count if free_memkb is not increasing */
+        if (free_memkb <= free_memkb_prev)
+            retries--;
+        free_memkb_prev = free_memkb;
     } while (retries > 0);

     return ERROR_NOMEM;
----------------------

I'm not sure if the above approach is always safe, but it works in my testing. 
I'd appreciate any other thoughts you might have before I try submitting an 
official patch for this...

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®.