aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/vmw_balloon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/vmw_balloon.c')
-rw-r--r--drivers/misc/vmw_balloon.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index cd41d403c9df..cb56e270da11 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -314,7 +314,7 @@ static bool vmballoon_send_get_target(struct vmballoon *b, u32 *new_target)
314 * fear that guest will need it. Host may reject some pages, we need to 314 * fear that guest will need it. Host may reject some pages, we need to
315 * check the return value and maybe submit a different page. 315 * check the return value and maybe submit a different page.
316 */ 316 */
317static bool vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, 317static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn,
318 unsigned int *hv_status) 318 unsigned int *hv_status)
319{ 319{
320 unsigned long status, dummy; 320 unsigned long status, dummy;
@@ -322,17 +322,17 @@ static bool vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn,
322 322
323 pfn32 = (u32)pfn; 323 pfn32 = (u32)pfn;
324 if (pfn32 != pfn) 324 if (pfn32 != pfn)
325 return false; 325 return -1;
326 326
327 STATS_INC(b->stats.lock); 327 STATS_INC(b->stats.lock);
328 328
329 *hv_status = status = VMWARE_BALLOON_CMD(LOCK, pfn, dummy); 329 *hv_status = status = VMWARE_BALLOON_CMD(LOCK, pfn, dummy);
330 if (vmballoon_check_status(b, status)) 330 if (vmballoon_check_status(b, status))
331 return true; 331 return 0;
332 332
333 pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status); 333 pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status);
334 STATS_INC(b->stats.lock_fail); 334 STATS_INC(b->stats.lock_fail);
335 return false; 335 return 1;
336} 336}
337 337
338/* 338/*
@@ -411,7 +411,7 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep)
411 struct page *page; 411 struct page *page;
412 gfp_t flags; 412 gfp_t flags;
413 unsigned int hv_status; 413 unsigned int hv_status;
414 bool locked = false; 414 int locked;
415 flags = can_sleep ? VMW_PAGE_ALLOC_CANSLEEP : VMW_PAGE_ALLOC_NOSLEEP; 415 flags = can_sleep ? VMW_PAGE_ALLOC_CANSLEEP : VMW_PAGE_ALLOC_NOSLEEP;
416 416
417 do { 417 do {
@@ -431,7 +431,7 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep)
431 431
432 /* inform monitor */ 432 /* inform monitor */
433 locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status); 433 locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status);
434 if (!locked) { 434 if (locked > 0) {
435 STATS_INC(b->stats.refused_alloc); 435 STATS_INC(b->stats.refused_alloc);
436 436
437 if (hv_status == VMW_BALLOON_ERROR_RESET || 437 if (hv_status == VMW_BALLOON_ERROR_RESET ||
@@ -449,7 +449,7 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep)
449 if (++b->n_refused_pages >= VMW_BALLOON_MAX_REFUSED) 449 if (++b->n_refused_pages >= VMW_BALLOON_MAX_REFUSED)
450 return -EIO; 450 return -EIO;
451 } 451 }
452 } while (!locked); 452 } while (locked != 0);
453 453
454 /* track allocated page */ 454 /* track allocated page */
455 list_add(&page->lru, &b->pages); 455 list_add(&page->lru, &b->pages);