All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] linux/balloon: prefer using pages from balloon in alloc_empty_pages_and_pagevec()
@ 2009-12-16 15:13 Jan Beulich
  2009-12-16 15:32 ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2009-12-16 15:13 UTC (permalink / raw)
  To: xen-devel; +Cc: Jeremy Fitzhardinge

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>

--- 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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-18 21:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-16 15:13 [PATCH] linux/balloon: prefer using pages from balloon in alloc_empty_pages_and_pagevec() Jan Beulich
2009-12-16 15:32 ` Jan Beulich
2009-12-17 20:33   ` Dave McCracken
2009-12-18  7:52     ` Jan Beulich
2009-12-18 14:32       ` Dave McCracken
2009-12-18 15:01         ` Jan Beulich
2009-12-18 21:03           ` Dave McCracken

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.