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

[Xen-changelog] [xen-unstable] libxl: Introduce a maximum limit for free_mem_slack (re (dom0) ballooning)



# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1285264897 -3600
# Node ID 4d95192b2fc8a0cfe88adee994c1f5117eefd86e
# Parent  50c1cc209f8fc08f8c47b4068e3a8cb15a4d52d2
libxl: Introduce a maximum limit for free_mem_slack (re (dom0) ballooning)

This fixes this message:
 libxl: error: libxl.c:2921:libxl_set_memory_target new target
               for dom0 is below the minimum threshold
which can occur spuriously if dom0_mem is specified and xl
autoballoning is left turned on.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Tested-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff -r 50c1cc209f8f -r 4d95192b2fc8 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Sep 22 18:29:24 2010 +0100
+++ b/tools/libxl/libxl.c       Thu Sep 23 19:01:37 2010 +0100
@@ -2785,6 +2785,7 @@ static int libxl__fill_dom0_memory_info(
     char *free_mem_slack_path = "/local/domain/0/memory/freemem-slack";
     xs_transaction_t t;
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    uint32_t free_mem_slack = 0;
 
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
@@ -2814,8 +2815,14 @@ retry_transaction:
             (uint32_t) info.current_memkb);
     libxl__xs_write(gc, t, max_path, "%"PRIu32,
             (uint32_t) info.max_memkb);
-    libxl__xs_write(gc, t, free_mem_slack_path, "%"PRIu32, (uint32_t)
-            (PAGE_TO_MEMKB(physinfo.total_pages) - info.current_memkb));
+
+    free_mem_slack = (uint32_t) (PAGE_TO_MEMKB(physinfo.total_pages) -
+            info.current_memkb);
+    /* From empirical measurements the free_mem_slack shouldn't be more
+     * than 15% of the total memory present on the system. */
+    if (free_mem_slack > PAGE_TO_MEMKB(physinfo.total_pages) * 0.15)
+        free_mem_slack = PAGE_TO_MEMKB(physinfo.total_pages) * 0.15;
+    libxl__xs_write(gc, t, free_mem_slack_path, "%"PRIu32, free_mem_slack);
 
     *target_memkb = (uint32_t) info.current_memkb;
     rc = 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.