Skip to content

Commit

Permalink
xen/balloon: Simplify HVM integration
Browse files Browse the repository at this point in the history
Simplify HVM integration proposed by Stefano Stabellini
in 53d5522.

Acked-by: Ian Campbell <[email protected]>
Acked-by: Daniel De Graaf <[email protected]>
Signed-off-by: Daniel Kiper <[email protected]>
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
  • Loading branch information
dkiper authored and konradwilk committed Mar 30, 2011
1 parent a7f3c8f commit 4dfe22f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
set_phys_to_machine(pfn, frame_list[i]);

/* Link back into the page tables if not highmem. */
if (!xen_hvm_domain() && !PageHighMem(page)) {
if (xen_pv_domain() && !PageHighMem(page)) {
int ret;
ret = HYPERVISOR_update_va_mapping(
(unsigned long)__va(pfn << PAGE_SHIFT),
Expand Down Expand Up @@ -293,7 +293,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)

scrub_page(page);

if (!xen_hvm_domain() && !PageHighMem(page)) {
if (xen_pv_domain() && !PageHighMem(page)) {
ret = HYPERVISOR_update_va_mapping(
(unsigned long)__va(pfn << PAGE_SHIFT),
__pte_ma(0), 0);
Expand Down Expand Up @@ -429,19 +429,15 @@ EXPORT_SYMBOL(free_xenballooned_pages);

static int __init balloon_init(void)
{
unsigned long pfn, nr_pages, extra_pfn_end;
unsigned long pfn, extra_pfn_end;
struct page *page;

if (!xen_domain())
return -ENODEV;

pr_info("xen/balloon: Initialising balloon driver.\n");

if (xen_pv_domain())
nr_pages = xen_start_info->nr_pages;
else
nr_pages = max_pfn;
balloon_stats.current_pages = min(nr_pages, max_pfn);
balloon_stats.current_pages = xen_pv_domain() ? min(xen_start_info->nr_pages, max_pfn) : max_pfn;
balloon_stats.target_pages = balloon_stats.current_pages;
balloon_stats.balloon_low = 0;
balloon_stats.balloon_high = 0;
Expand Down

0 comments on commit 4dfe22f

Please sign in to comment.