WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Introduce a maximum limit for free_mem_slack

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Introduce a maximum limit for free_mem_slack
From: Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Date: Thu, 23 Sep 2010 13:41:19 -0400
Accept-language: en-US
Cc:
Delivery-date: Thu, 23 Sep 2010 10:57:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Resent-date: Thu, 23 Sep 2010 18:56:50 +0100
Resent-date: Thu, 23 Sep 2010 18:56:50 +0100
Resent-from: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Resent-message-id: <19611.38114.385720.584228@xxxxxxxxxxxxxxxxxxxxxxxx>
Resent-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: ActbRljIYzm+tLlDTQG4dUG7+iFOEw==
Thread-topic: [PATCH] Introduce a maximum limit for free_mem_slack
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
Introduce a maximum limit for free_mem_slack

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff -r 50c1cc209f8f 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 18:37:58 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Introduce a maximum limit for free_mem_slack, Stefano Stabellini <=