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

[Xen-changelog] [xen master] libxl: Wait for ballooning if free memory is increasing



commit 2563bca11544361dc2afa5e20b5663e10a0715cb
Author:     Mike Latimer <mlatimer@xxxxxxxx>
AuthorDate: Fri Jan 30 14:01:00 2015 -0700
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Feb 5 12:14:14 2015 +0000

    libxl: Wait for ballooning if free memory is increasing
    
    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.
    
    In order to accommodate large domains or slower hardware (which require
    substantially longer to balloon memory) the free memory process should
    continue retrying if the amount of free memory is increasing on each
    iteration of the loop.
    
    Signed-off-by: Mike Latimer <mlatimer@xxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index b7eac29..440db78 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2198,8 +2198,9 @@ 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;
+    int rc, retries;
+    const int MAX_RETRIES = 3;
+    uint32_t need_memkb, free_memkb, free_memkb_prev = 0;
 
     if (!autoballoon)
         return 0;
@@ -2208,6 +2209,7 @@ static int freemem(uint32_t domid, 
libxl_domain_build_info *b_info)
     if (rc < 0)
         return rc;
 
+    retries = MAX_RETRIES;
     do {
         rc = libxl_get_free_memory(ctx, &free_memkb);
         if (rc < 0)
@@ -2232,7 +2234,16 @@ static int freemem(uint32_t domid, 
libxl_domain_build_info *b_info)
         if (rc < 0)
             return rc;
 
-        retries--;
+        /*
+         * If the amount of free mem has increased on this iteration (i.e.
+         * some progress has been made) then reset the retry counter.
+         */
+        if (free_memkb > free_memkb_prev) {
+            retries = MAX_RETRIES;
+            free_memkb_prev = free_memkb;
+        } else {
+            retries--;
+        }
     } while (retries > 0);
 
     return ERROR_NOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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