[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 1 of 4] Prevent low values of max_pages for domains doing sharing or paging
>>> On 16.02.12 at 04:57, Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> 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. > > 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). > > Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> > > 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; I don't think this is appropriate here, as it will allow not only paging/sharing allocations to succeed, but also such that aren't intended to. I think that *if* an override to the limit enforcement is needed, it ought to be implemented by passing a special flag to the page allocator to have it make an exception. But that's questionable in the first place - if a domain is told to shrink, it ought to follow that directive (and the paging/sharing code then probably should obtain a page from inside the guest; I realize that might be problematic when sharing is enabled but paging isn't). Jan > ret = 0; > spin_unlock(&d->page_alloc_lock); > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxxxxxxxx > http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |