diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/balloon.c | 12 | ||||
-rw-r--r-- | drivers/xen/gntdev.c | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 5dfd8f8ff07..cd8b4704ef4 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -501,20 +501,24 @@ EXPORT_SYMBOL_GPL(balloon_set_new_target); | |||
501 | * alloc_xenballooned_pages - get pages that have been ballooned out | 501 | * alloc_xenballooned_pages - get pages that have been ballooned out |
502 | * @nr_pages: Number of pages to get | 502 | * @nr_pages: Number of pages to get |
503 | * @pages: pages returned | 503 | * @pages: pages returned |
504 | * @highmem: highmem or lowmem pages | ||
504 | * @return 0 on success, error otherwise | 505 | * @return 0 on success, error otherwise |
505 | */ | 506 | */ |
506 | int alloc_xenballooned_pages(int nr_pages, struct page** pages) | 507 | int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem) |
507 | { | 508 | { |
508 | int pgno = 0; | 509 | int pgno = 0; |
509 | struct page* page; | 510 | struct page* page; |
510 | mutex_lock(&balloon_mutex); | 511 | mutex_lock(&balloon_mutex); |
511 | while (pgno < nr_pages) { | 512 | while (pgno < nr_pages) { |
512 | page = balloon_retrieve(true); | 513 | page = balloon_retrieve(highmem); |
513 | if (page) { | 514 | if (page && PageHighMem(page) == highmem) { |
514 | pages[pgno++] = page; | 515 | pages[pgno++] = page; |
515 | } else { | 516 | } else { |
516 | enum bp_state st; | 517 | enum bp_state st; |
517 | st = decrease_reservation(nr_pages - pgno, GFP_HIGHUSER); | 518 | if (page) |
519 | balloon_append(page); | ||
520 | st = decrease_reservation(nr_pages - pgno, | ||
521 | highmem ? GFP_HIGHUSER : GFP_USER); | ||
518 | if (st != BP_DONE) | 522 | if (st != BP_DONE) |
519 | goto out_undo; | 523 | goto out_undo; |
520 | } | 524 | } |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index f914b26cf0c..7b9b1d1b75a 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -123,7 +123,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | |||
123 | NULL == add->pages) | 123 | NULL == add->pages) |
124 | goto err; | 124 | goto err; |
125 | 125 | ||
126 | if (alloc_xenballooned_pages(count, add->pages)) | 126 | if (alloc_xenballooned_pages(count, add->pages, false /* lowmem */)) |
127 | goto err; | 127 | goto err; |
128 | 128 | ||
129 | for (i = 0; i < count; i++) { | 129 | for (i = 0; i < count; i++) { |