From: Ian Campbell <Ian.Campbell@citrix.com>
To: Mike Latimer <mlatimer@suse.com>
Cc: george.dunlap@eu.citrix.com, wei.liu2@citrix.com,
Stefano.Stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com,
xen-devel@lists.xen.org
Subject: Re: [PATCH v3] libxl: Wait for ballooning if free memory is increasing
Date: Mon, 2 Feb 2015 14:35:39 +0000 [thread overview]
Message-ID: <1422887739.19293.34.camel@citrix.com> (raw)
In-Reply-To: <1422651660-17368-1-git-send-email-mlatimer@suse.com>
On Fri, 2015-01-30 at 14:01 -0700, Mike Latimer wrote:
> During domain startup, all required memory ballooning must complete
> within a maximum window of 33 seconds (3 retries, 11 seconds of delay).
> If not, domain creation is aborted with a 'failed to free memory' error.
>
> In order to accommodate large domains or slower hardware (which require
> substantially longer to balloon memory) the free memory process should
> continue retrying if the amount of free memory is increasing on each
> iteration of the loop.
Sorry for not spotting this earlier, but to accept a patch into the Xen
code base we need a Signed-off-by:
http://wiki.xen.org/wiki/Submitting_Xen_Patches#Signing_off_a_patch
You can provide one in this thread rather than resending if that is more
convenient.
For my part: Acked-by: Ian Campbell <ian.campbell@citrix.com>
>
> ---
> tools/libxl/xl_cmdimpl.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 0b02a6c..9ff3c4f 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -2194,8 +2194,9 @@ static int preserve_domain(uint32_t *r_domid, libxl_event *event,
>
> static int freemem(uint32_t domid, libxl_domain_build_info *b_info)
> {
> - int rc, retries = 3;
> - uint32_t need_memkb, free_memkb;
> + int rc, retries;
> + const int MAX_RETRIES = 3;
> + uint32_t need_memkb, free_memkb, free_memkb_prev = 0;
>
> if (!autoballoon)
> return 0;
> @@ -2204,6 +2205,7 @@ static int freemem(uint32_t domid, libxl_domain_build_info *b_info)
> if (rc < 0)
> return rc;
>
> + retries = MAX_RETRIES;
> do {
> rc = libxl_get_free_memory(ctx, &free_memkb);
> if (rc < 0)
> @@ -2228,7 +2230,16 @@ static int freemem(uint32_t domid, libxl_domain_build_info *b_info)
> if (rc < 0)
> return rc;
>
> - retries--;
> + /*
> + * If the amount of free mem has increased on this iteration (i.e.
> + * some progress has been made) then reset the retry counter.
> + */
> + if (free_memkb > free_memkb_prev) {
> + retries = MAX_RETRIES;
> + free_memkb_prev = free_memkb;
> + } else {
> + retries--;
> + }
> } while (retries > 0);
>
> return ERROR_NOMEM;
next prev parent reply other threads:[~2015-02-02 14:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 21:01 [PATCH v3] libxl: Wait for ballooning if free memory is increasing Mike Latimer
2015-02-02 14:35 ` Ian Campbell [this message]
2015-02-02 15:17 ` Mike Latimer
2015-02-05 12:45 ` Ian Campbell
2015-02-11 4:17 ` Mike Latimer
2015-02-13 11:01 ` Wei Liu
2015-02-13 23:16 ` Mike Latimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422887739.19293.34.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=mlatimer@suse.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.