Skip to content

Commit

Permalink
xen/balloon: Only mark a page as managed when it is released
Browse files Browse the repository at this point in the history
Only mark a page as managed when it is released back to the allocator.
This ensures that the managed page count does not get falsely increased
when a VM is running. Correspondingly change it so that pages are
marked as unmanaged after getting them from the allocator.

Signed-off-by: Ross Lagerwall <[email protected]>
Reviewed-by: Boris Ostrovsky <[email protected]>
Signed-off-by: Juergen Gross <[email protected]>
  • Loading branch information
rosslagerwall authored and jgross1 committed Dec 12, 2016
1 parent 581d21a commit 709613a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ static void __balloon_append(struct page *page)
static void balloon_append(struct page *page)
{
__balloon_append(page);
adjust_managed_page_count(page, -1);
}

/* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
Expand All @@ -201,8 +200,6 @@ static struct page *balloon_retrieve(bool require_lowmem)
else
balloon_stats.balloon_low--;

adjust_managed_page_count(page, 1);

return page;
}

Expand Down Expand Up @@ -478,7 +475,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
#endif

/* Relinquish the page back to the allocator. */
__free_reserved_page(page);
free_reserved_page(page);
}

balloon_stats.current_pages += rc;
Expand Down Expand Up @@ -509,6 +506,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
state = BP_EAGAIN;
break;
}
adjust_managed_page_count(page, -1);
scrub_page(page);
list_add(&page->lru, &pages);
}
Expand Down

0 comments on commit 709613a

Please sign in to comment.