ia64/xen-unstable

changeset 10185:93db1b536f38

[XEND] Wait sufficient time for memory to balloon out before creating a new domain.

On the ES7000 when Dom0 boots up with all of system memory and you try
to bring up a DomU with more than 2GB of memory, xend times out before
the memory is freed causing the domain not to be created. This patch
increases the timeout depending on the amount of memory that needs to be
freed. It also places a cap on the sleep time so that it does not grow
without a limit. This fixes bug# 650

http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=3D650

Signed-off-by: Aravindh Puthiyaparambil
<aravindh.puthiyaparambil@unisys.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu May 25 21:41:04 2006 +0100 (2006-05-25)
parents 26b8e3e7430d
children ac4a961f7e64
files tools/python/xen/xend/balloon.py
line diff
     1.1 --- a/tools/python/xen/xend/balloon.py	Thu May 25 21:24:47 2006 +0100
     1.2 +++ b/tools/python/xen/xend/balloon.py	Thu May 25 21:41:04 2006 +0100
     1.3 @@ -32,6 +32,7 @@ PROC_XEN_BALLOON = '/proc/xen/balloon'
     1.4  BALLOON_OUT_SLACK = 1 # MiB.  We need this because the physinfo details are
     1.5                        # rounded.
     1.6  RETRY_LIMIT = 10
     1.7 +RETRY_LIMIT_INCR = 5
     1.8  ##
     1.9  # The time to sleep between retries grows linearly, using this value (in
    1.10  # seconds).  When the system is lightly loaded, memory should be scrubbed and
    1.11 @@ -118,7 +119,8 @@ def free(required):
    1.12          retries = 0
    1.13          sleep_time = SLEEP_TIME_GROWTH
    1.14          last_new_alloc = None
    1.15 -        while retries < RETRY_LIMIT:
    1.16 +        rlimit = RETRY_LIMIT
    1.17 +        while retries < rlimit:
    1.18              free_mem = xc.physinfo()['free_memory']
    1.19  
    1.20              if free_mem >= need_mem:
    1.21 @@ -127,7 +129,9 @@ def free(required):
    1.22                  return
    1.23  
    1.24              if retries == 0:
    1.25 -                log.debug("Balloon: free %d; need %d.", free_mem, need_mem)
    1.26 +                rlimit += ((need_mem - free_mem)/1024) * RETRY_LIMIT_INCR
    1.27 +                log.debug("Balloon: free %d; need %d; retries: %d.", 
    1.28 +                          free_mem, need_mem, rlimit)
    1.29  
    1.30              if dom0_min_mem > 0:
    1.31                  dom0_alloc = get_dom0_current_alloc()
    1.32 @@ -143,8 +147,9 @@ def free(required):
    1.33                      # Continue to retry, waiting for ballooning.
    1.34  
    1.35              time.sleep(sleep_time)
    1.36 +            if retries < 2 * RETRY_LIMIT:
    1.37 +                sleep_time += SLEEP_TIME_GROWTH
    1.38              retries += 1
    1.39 -            sleep_time += SLEEP_TIME_GROWTH
    1.40  
    1.41          # Not enough memory; diagnose the problem.
    1.42          if dom0_min_mem == 0: