ia64/xen-unstable

changeset 8992:70575c8cab99

Return <4GB memory back to Xen when destroying a PAE pgdir.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Feb 24 08:49:32 2006 +0100 (2006-02-24)
parents 5e73c92e5f1f
children e33ebd143767
files linux-2.6-xen-sparse/arch/i386/mm/init-xen.c linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c	Fri Feb 24 08:28:04 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/init-xen.c	Fri Feb 24 08:49:32 2006 +0100
     1.3 @@ -759,7 +759,7 @@ void __init pgtable_cache_init(void)
     1.4  #endif
     1.5  				0,
     1.6  				pgd_ctor,
     1.7 -				PTRS_PER_PMD == 1 ? pgd_dtor : NULL);
     1.8 +				pgd_dtor);
     1.9  	if (!pgd_cache)
    1.10  		panic("pgtable_cache_init(): Cannot create pgd cache");
    1.11  }
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Fri Feb 24 08:28:04 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/mm/pgtable-xen.c	Fri Feb 24 08:49:32 2006 +0100
     2.3 @@ -320,16 +320,20 @@ void pgd_ctor(void *pgd, kmem_cache_t *c
     2.4  	}
     2.5  }
     2.6  
     2.7 -/* never called when PTRS_PER_PMD > 1 */
     2.8  void pgd_dtor(void *pgd, kmem_cache_t *cache, unsigned long unused)
     2.9  {
    2.10  	unsigned long flags; /* can be called from interrupt context */
    2.11  
    2.12 -	spin_lock_irqsave(&pgd_lock, flags);
    2.13 -	pgd_list_del(pgd);
    2.14 -	spin_unlock_irqrestore(&pgd_lock, flags);
    2.15 +	if (PTRS_PER_PMD > 1) {
    2.16 +		if (!xen_feature(XENFEAT_pae_pgdir_above_4gb))
    2.17 +			xen_destroy_contiguous_region((unsigned long)pgd, 0);
    2.18 +	} else {
    2.19 +		spin_lock_irqsave(&pgd_lock, flags);
    2.20 +		pgd_list_del(pgd);
    2.21 +		spin_unlock_irqrestore(&pgd_lock, flags);
    2.22  
    2.23 -	pgd_test_and_unpin(pgd);
    2.24 +		pgd_test_and_unpin(pgd);
    2.25 +	}
    2.26  }
    2.27  
    2.28  pgd_t *pgd_alloc(struct mm_struct *mm)