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-changelog

[Xen-changelog] fix ballooning out logic to handle dying domain freeing

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] fix ballooning out logic to handle dying domain freeing memory.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 10 Sep 2005 15:12:12 +0000
Delivery-date: Sat, 10 Sep 2005 15:10:48 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User vh249@xxxxxxxxxxxxxxxxxxxxxx
# Node ID bc5e0fc79696086a29cd1eddd9363afa59c0b6fb
# Parent  b3b4391a14e5f902a954a4aa0520fba1193163cf
fix ballooning out logic to handle dying domain freeing memory.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r b3b4391a14e5 -r bc5e0fc79696 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Sat Sep 10 14:42:39 2005
+++ b/tools/python/xen/xm/create.py     Sat Sep 10 14:43:46 2005
@@ -772,30 +772,33 @@
     """Balloon out memory from dom0 if necessary"""
     SLACK = 4
     timeout = 20 # 2s
-    ret = 0
+    ret = 1
 
     xc = xen.lowlevel.xc.new()
-    pinfo = xc.physinfo()
-    free_mem = pinfo['free_pages'] / 256
+    free_mem = xc.physinfo()['free_pages'] / 256
     domU_need_mem = opts.vals.memory + SLACK 
+
+    # we already have enough free memory, return success
+    if free_mem >= domU_need_mem:
+        del xc
+        return 0
 
     dom0_cur_alloc = get_dom0_alloc()
     dom0_new_alloc = dom0_cur_alloc - (domU_need_mem - free_mem)
-
-    if free_mem < domU_need_mem and dom0_new_alloc < dom0_min_mem:
-        ret = 1
-    if free_mem < domU_need_mem and ret == 0:
-
-        server.xend_domain_mem_target_set(0, dom0_new_alloc)
-
-        while dom0_cur_alloc > dom0_new_alloc and timeout > 0:
-            time.sleep(0.1) # sleep 100ms
-            dom0_cur_alloc = get_dom0_alloc()
-            timeout -= 1
-        
-        if dom0_cur_alloc > dom0_new_alloc:
-            ret = 1
-    
+    if dom0_new_alloc < dom0_min_mem:
+        dom0_new_alloc = dom0_min_mem
+
+    server.xend_domain_mem_target_set(0, dom0_new_alloc)
+
+    while timeout > 0:
+        time.sleep(0.1) # sleep 100ms
+
+        free_mem = xc.physinfo()['free_pages'] / 256
+        if free_mem >= domU_need_mem:
+            ret = 0
+            break
+        timeout -= 1
+
     del xc
     return ret
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] fix ballooning out logic to handle dying domain freeing memory., Xen patchbot -unstable <=