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] Re: [Xen-changelog] fail domU creation if memory need couldn

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: [Xen-changelog] fail domU creation if memory need couldn't be succeed after ballooning out dom0
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Thu, 18 Aug 2005 09:35:56 -0500
Delivery-date: Thu, 18 Aug 2005 14:34:46 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <E1E5gyR-0002hM-Mf@xxxxxxxxxxxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1E5gyR-0002hM-Mf@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)
I don't mean to pick on this patch, but I've been chasing down a number of race conditions in Xend that mostly seem to be rooted in the fact that we do a lot of timeouts.

In general, we should try to avoid using timeouts at all cost. If we do have to use a timeout, then we should make sure it's long enough that the timeout is never going to happen. It's surprisingly easy to have enough load on your system such you miss a 2 second timeout.

Getting rid of this timeout would be difficult so for now, we should at least bump it to 30 or 60 seconds.

Thanks,

Anthony Liguori

Xen patchbot -unstable wrote:

diff -r 02789fed726a -r a06430752462 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Wed Aug 17 23:11:56 2005
+++ b/tools/python/xen/xm/create.py     Thu Aug 18 01:13:49 2005
@@ -23,6 +23,7 @@
import sys
import socket
import commands
+import time

import xen.lowlevel.xc

@@ -674,18 +675,33 @@
    return 0

def balloon_out(dom0_min_mem, opts):
-    """Balloon out to get memory for domU, if necessarily"""
+    """Balloon out memory from dom0 if necessary"""
    SLACK = 4
+    timeout = 20 # 2s
+    ret = 0

    xc = xen.lowlevel.xc.new()
    pinfo = xc.physinfo()
-    free_mem = pinfo['free_pages']/256
-    if free_mem < opts.vals.memory + SLACK:
-        need_mem = opts.vals.memory + SLACK - free_mem
-        cur_alloc = get_dom0_alloc()
-        if cur_alloc - need_mem >= dom0_min_mem:
-            server.xend_domain_mem_target_set(0, cur_alloc - need_mem)
+    free_mem = pinfo['free_pages'] / 256
+ domU_need_mem = opts.vals.memory + SLACK +
+    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:
+
+        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
+ del xc
+    return ret

def main(argv):
    random.seed()
@@ -717,7 +733,8 @@
    else:
        dom0_min_mem = xroot.get_dom0_min_mem()
        if dom0_min_mem != 0:
-            balloon_out(dom0_min_mem, opts)
+            if balloon_out(dom0_min_mem, opts):
+                return

        dom = make_domain(opts, config)
        if opts.vals.console_autoconnect:

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



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] Re: [Xen-changelog] fail domU creation if memory need couldn't be succeed after ballooning out dom0, Anthony Liguori <=