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@novell.com>
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;