Skip to contentSkip to conversation

Allow max_pages to be set to less than tot_pages

PATCH In review Tim Deegan 2 participants 2 messages Oct 21, 2010

lore
Share & tools
lore

Tim Deegan

author
#0 lore raw

PATCH 1/1 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.

xen/common/domctl.c +5 -5
diff -r 95226c6fe89b xen/common/domctl.c
@@ -675,11 +675,11 @@
         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;
-        }
+        /* N.B. We removed a check that new_max >= current tot_pages;
+         * this means the domain will "ratchet" down to new_max.
+         * In the meantime tot will be > max. */
+        d->max_pages = new_max;
+        ret = 0;
         spin_unlock(&d->page_alloc_lock);
 
     max_mem_out:
Acked-by on v1 1/1
#1 lore raw

Tim Deegan writes ("[Xen-devel] [PATCH] Allow max_pages to be set to less than tot_pages"):

Quoted 7 lines

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.

Ian.