aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-10-19 17:59:37 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-11-09 09:15:28 -0500
commitd9263f978f03a4b936d8cc69dd7835d635bdb578 (patch)
treec6c4d19a13a5a5b7d9bbf7faba84d6b656bd4aaa
parentd70796521aaf9afabe64b0d80d448e45879ea699 (diff)
downloadxen-d9263f978f03a4b936d8cc69dd7835d635bdb578.tar.gz
xen/balloon: Avoid OOM when requesting highmem
If highmem pages are requested from the balloon on a system without highmem, the implementation of alloc_xenballooned_pages will allocate all available memory trying to find highmem pages to return. Allow low memory to be returned when highmem pages are requested to avoid this loop. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r--drivers/xen/balloon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index a767884a6c7a10..31ab82fda38a26 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -501,7 +501,7 @@ EXPORT_SYMBOL_GPL(balloon_set_new_target);
* alloc_xenballooned_pages - get pages that have been ballooned out
* @nr_pages: Number of pages to get
* @pages: pages returned
- * @highmem: highmem or lowmem pages
+ * @highmem: allow highmem pages
* @return 0 on success, error otherwise
*/
int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem)
@@ -511,7 +511,7 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem)
mutex_lock(&balloon_mutex);
while (pgno < nr_pages) {
page = balloon_retrieve(highmem);
- if (page && PageHighMem(page) == highmem) {
+ if (page && (highmem || !PageHighMem(page))) {
pages[pgno++] = page;
} else {
enum bp_state st;