diff options
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/balloon.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 37d06ea624aa..61a6ac8fa8fc 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -399,11 +399,25 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
399 | state = BP_EAGAIN; | 399 | state = BP_EAGAIN; |
400 | break; | 400 | break; |
401 | } | 401 | } |
402 | scrub_page(page); | ||
402 | 403 | ||
403 | pfn = page_to_pfn(page); | 404 | frame_list[i] = page_to_pfn(page); |
404 | frame_list[i] = pfn_to_mfn(pfn); | 405 | } |
405 | 406 | ||
406 | scrub_page(page); | 407 | /* |
408 | * Ensure that ballooned highmem pages don't have kmaps. | ||
409 | * | ||
410 | * Do this before changing the p2m as kmap_flush_unused() | ||
411 | * reads PTEs to obtain pages (and hence needs the original | ||
412 | * p2m entry). | ||
413 | */ | ||
414 | kmap_flush_unused(); | ||
415 | |||
416 | /* Update direct mapping, invalidate P2M, and add to balloon. */ | ||
417 | for (i = 0; i < nr_pages; i++) { | ||
418 | pfn = frame_list[i]; | ||
419 | frame_list[i] = pfn_to_mfn(pfn); | ||
420 | page = pfn_to_page(pfn); | ||
407 | 421 | ||
408 | #ifdef CONFIG_XEN_HAVE_PVMMU | 422 | #ifdef CONFIG_XEN_HAVE_PVMMU |
409 | /* | 423 | /* |
@@ -429,11 +443,9 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
429 | } | 443 | } |
430 | #endif | 444 | #endif |
431 | 445 | ||
432 | balloon_append(pfn_to_page(pfn)); | 446 | balloon_append(page); |
433 | } | 447 | } |
434 | 448 | ||
435 | /* Ensure that ballooned highmem pages don't have kmaps. */ | ||
436 | kmap_flush_unused(); | ||
437 | flush_tlb_all(); | 449 | flush_tlb_all(); |
438 | 450 | ||
439 | set_xen_guest_handle(reservation.extent_start, frame_list); | 451 | set_xen_guest_handle(reservation.extent_start, frame_list); |