[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux/balloon: prefer using pages from balloon in alloc_empty_pages_and_pagevec()



This is both faster and less demanding on kernel resources.

Likely also something that could be done in the pv-ops tree (though it
would need some adjustment to deal with the balloon_order!=0 case).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- head-2009-12-07.orig/drivers/xen/balloon/balloon.c  2009-12-15 
09:37:50.000000000 +0100
+++ head-2009-12-07/drivers/xen/balloon/balloon.c       2009-12-15 
09:47:04.000000000 +0100
@@ -607,6 +607,17 @@ struct page **alloc_empty_pages_and_page
                return NULL;
 
        for (i = 0; i < nr_pages; i++) {
+               balloon_lock(flags);
+               page = balloon_first_page();
+               if (page && !PageHighMem(page)) {
+                       UNLIST_PAGE(page);
+                       bs.balloon_low--;
+                       balloon_unlock(flags);
+                       pagevec[i] = page;
+                       continue;
+               }
+               balloon_unlock(flags);
+
                page = pagevec[i] = alloc_page(GFP_KERNEL|__GFP_COLD);
                if (page == NULL)
                        goto err;




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.