diff options
author | Keir Fraser <keir@xen.org> | 2010-10-24 13:13:04 +0100 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2010-10-24 13:13:04 +0100 |
commit | d6b5b105305dcc2c200ab82b942489902ef7dc7a (patch) | |
tree | 43d29b1e8660c9f9c6f8914844a3a781b3d3a945 /xen/common/domctl.c | |
parent | 7e6b926a17db1d63f1b8fd2745776f5369dacb4e (diff) | |
download | xen-d6b5b105305dcc2c200ab82b942489902ef7dc7a.tar.gz xen-d6b5b105305dcc2c200ab82b942489902ef7dc7a.tar.bz2 xen-d6b5b105305dcc2c200ab82b942489902ef7dc7a.zip |
Allow max_pages to be set to less than tot_pages
The memory allocation code sometimes needs to enforce that a guest
that's been told to balloon down isn't going to expand further
(because it's still executing a previous balloon-up operation). That
means being able to set the desired max_pages even before the balloon
driver has brought tot_pages down to the right level.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'xen/common/domctl.c')
-rw-r--r-- | xen/common/domctl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 7bc976eb79..f45c62e93c 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -770,11 +770,13 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT-10); spin_lock(&d->page_alloc_lock); - if ( new_max >= d->tot_pages ) - { - d->max_pages = new_max; - ret = 0; - } + /* + * 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. + */ + d->max_pages = new_max; + ret = 0; spin_unlock(&d->page_alloc_lock); max_mem_out: |