ia64/xen-unstable

changeset 9900:ce48ea86ad72

Balloon driver: when in autotranslate mode, pages are returned
to xen without traversing init_mm.
This change is needed for xen/ia64 vp model.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author kaf24@firebug.cl.cam.ac.uk
date Sun Apr 30 09:47:51 2006 +0100 (2006-04-30)
parents 3e5a203c5489
children 9ffa49fe58ab
files linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Sun Apr 30 09:39:04 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Sun Apr 30 09:47:51 2006 +0100
     1.3 @@ -550,9 +550,22 @@ struct page *balloon_alloc_empty_page_ra
     1.4  	scrub_pages(vstart, 1 << order);
     1.5  
     1.6  	balloon_lock(flags);
     1.7 -	ret = apply_to_page_range(&init_mm, vstart,
     1.8 -				  PAGE_SIZE << order, dealloc_pte_fn, NULL);
     1.9 -	BUG_ON(ret);
    1.10 +	if (xen_feature(XENFEAT_auto_translated_physmap)) {
    1.11 +		unsigned long gmfn = __pa(vstart) >> PAGE_SHIFT;
    1.12 +		struct xen_memory_reservation reservation = {
    1.13 +			.nr_extents   = 1,
    1.14 +			.extent_order = order,
    1.15 +			.domid        = DOMID_SELF
    1.16 +		};
    1.17 +		set_xen_guest_handle(reservation.extent_start, &gmfn);
    1.18 +		ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
    1.19 +					   &reservation);
    1.20 +		BUG_ON(ret != 1);
    1.21 +	} else {
    1.22 +		ret = apply_to_page_range(&init_mm, vstart, PAGE_SIZE << order,
    1.23 +					  dealloc_pte_fn, NULL);
    1.24 +		BUG_ON(ret);
    1.25 +	}
    1.26  	current_pages -= 1UL << order;
    1.27  	totalram_pages = current_pages;
    1.28  	balloon_unlock(flags);