xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Cc: andres@gridcentric.ca, xen-devel@lists.xensource.com,
	adin@gridcentric.ca
Subject: Re: [PATCH 1 of 4] Prevent low values of max_pages for domains doing sharing or paging
Date: Thu, 16 Feb 2012 10:20:14 +0000	[thread overview]
Message-ID: <20120216102014.GA40020@ocelot.phlegethon.org> (raw)
In-Reply-To: <11fd4e0a1e1a76ca3bc1.1329364624@xdev.gridcentric.ca>

At 22:57 -0500 on 15 Feb (1329346624), Andres Lagar-Cavilla wrote:
>  xen/common/domctl.c |  8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> 
> Apparently, setting d->max_pages to something lower than d->tot_pages is
> used as a mechanism for controling a domain's footprint. It will result
> in all new page allocations failing.

Yep.  

> This is a really bad idea with paging or sharing, as regular guest memory
> accesses may need to be satisfied by allocating new memory (either to
> page in or to unshare).

Nack.  If a domain ends up with a max_pages so low that it can't page
in, that's a tools bug.  This patch doesn't fix it, because the
toolstack could set new max == current tot (er, +1) and then you have
the same problem if you page in twice.   (And also it silently ignores
the update rather than reporting an error.)

Tim.

> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
> 
> diff -r 62b1fe67b8d1 -r 11fd4e0a1e1a xen/common/domctl.c
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -813,8 +813,14 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
>           * NB. We removed a check that new_max >= current tot_pages; this means
>           * that the domain will now be allowed to "ratchet" down to new_max. In
>           * the meantime, while tot > max, all new allocations are disallowed.
> +         *
> +         * Except that this is not a great idea for domains doing sharing or 
> +         * paging, as they need to perform new allocations on the fly.
>           */
> -        d->max_pages = new_max;
> +        if ( (new_max > d->max_pages) ||
> +             !((d->mem_event->paging.ring_page != NULL) ||
> +                d->arch.hvm_domain.mem_sharing_enabled) )
> +            d->max_pages = new_max;
>          ret = 0;
>          spin_unlock(&d->page_alloc_lock);
>  

  parent reply	other threads:[~2012-02-16 10:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16  3:57 [PATCH 0 of 4] Handling of (some) low memory conditions Andres Lagar-Cavilla
2012-02-16  3:57 ` [PATCH 1 of 4] Prevent low values of max_pages for domains doing sharing or paging Andres Lagar-Cavilla
2012-02-16  9:16   ` Jan Beulich
2012-02-16 10:20   ` Tim Deegan [this message]
2012-02-16 14:45     ` Andres Lagar-Cavilla
2012-02-16 14:58       ` Tim Deegan
2012-02-16 15:32       ` Jan Beulich
2012-02-16 16:08         ` Tim Deegan
2012-02-16 16:44           ` Jan Beulich
2012-02-16  3:57 ` [PATCH 2 of 4] x86/mm: Allow to not sleep on mem event ring Andres Lagar-Cavilla
2012-02-16 16:11   ` Tim Deegan
2012-02-17 16:57     ` Andres Lagar-Cavilla
2012-02-16  3:57 ` [PATCH 3 of 4] Memory sharing: better handling of ENOMEM while unsharing Andres Lagar-Cavilla
2012-02-16 16:19   ` Tim Deegan
2012-02-17 17:01     ` Andres Lagar-Cavilla
2012-02-16  3:57 ` [PATCH 4 of 4] Global virq for low memory situations Andres Lagar-Cavilla
2012-02-16  9:31 ` [PATCH 0 of 4] Handling of (some) low memory conditions Jan Beulich
2012-02-16 14:40   ` Andres Lagar-Cavilla
2012-02-16 15:22     ` Jan Beulich
2012-02-16 15:34       ` Andres Lagar-Cavilla
2012-02-16 16:26         ` Jan Beulich

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=20120216102014.GA40020@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=adin@gridcentric.ca \
    --cc=andres@gridcentric.ca \
    --cc=andres@lagarcavilla.org \
    --cc=xen-devel@lists.xensource.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).