From: Stefano Stabellini Subject: [PATCH v2 4/4] libxl_wait_for_memory_target: wait for 2 sec at a time Date: Fri, 6 Mar 2015 17:19:17 +0000 Message-ID: <1425662357-9951-4-git-send-email-stefano.stabellini@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: Ian.Jackson@eu.citrix.com, mlatimer@suse.com, wei.liu2@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Use a 2 sec sleep time in the loop to allow the guest to release a decent amount of memory in an iteration (empirical tests show ballooning speed to be 512MB/sec or recent boxes). Signed-off-by: Stefano Stabellini Reviewed-by: Mike Latimer Tested-by: Mike Latimer --- tools/libxl/libxl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 648a227..94b4d59 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4970,7 +4970,7 @@ int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs) prev_memkb = UINT64_MAX; do { - sleep(1); + sleep(2); libxl_dominfo_dispose(&info); libxl_dominfo_init(&info); @@ -4986,7 +4986,7 @@ int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs) goto out; } else if (current_memkb == prev_memkb) - wait_secs--; + wait_secs -= 2; /* if current_memkb < prev_memkb loop for free as progress has * been made */ -- 1.7.10.4