ia64/xen-unstable

changeset 3941:0dc6a70c0a02

bitkeeper revision 1.1159.258.14 (4220bd64Y3CN44gbDCh9mtv5s9QiDA)

Fix ballooning where initial allocation is lower than max possible lowmem.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@viper.(none)
date Sat Feb 26 18:18:12 2005 +0000 (2005-02-26)
parents 73625446964d
children 99fd3686e9b3 8a2d8a8a5415
files linux-2.4.29-xen-sparse/arch/xen/mm/init.c linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c xen/arch/x86/domain.c
line diff
     1.1 --- a/linux-2.4.29-xen-sparse/arch/xen/mm/init.c	Fri Feb 25 01:18:50 2005 +0000
     1.2 +++ b/linux-2.4.29-xen-sparse/arch/xen/mm/init.c	Sat Feb 26 18:18:12 2005 +0000
     1.3 @@ -366,6 +366,12 @@ static int __init free_pages_init(void)
     1.4  
     1.5      /* this will put all low memory onto the freelists */
     1.6      totalram_pages += free_all_bootmem();
     1.7 +    /* XEN: init and count low-mem pages outside initial allocation. */
     1.8 +    for (pfn = boot_pfn; pfn < max_low_pfn; pfn++) {
     1.9 +        ClearPageReserved(&mem_map[pfn]);
    1.10 +        atomic_set(&mem_map[pfn].count, 1);
    1.11 +        totalram_pages++;
    1.12 +    }
    1.13  
    1.14      reservedpages = 0;
    1.15      for (pfn = 0; pfn < boot_pfn ; pfn++) {
     2.1 --- a/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c	Fri Feb 25 01:18:50 2005 +0000
     2.2 +++ b/linux-2.6.10-xen-sparse/arch/xen/i386/mm/init.c	Sat Feb 26 18:18:12 2005 +0000
     2.3 @@ -177,8 +177,10 @@ static void __init kernel_physical_mappi
     2.4  				pte = one_page_table_init(pmd);
     2.5  
     2.6  				pte += pte_ofs;
     2.7 -				/* XEN: Only map initial RAM allocation. */
     2.8 -				for (; pte_ofs < PTRS_PER_PTE && pfn < max_ram_pfn; pte++, pfn++, pte_ofs++) {
     2.9 +				for (; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++) {
    2.10 +						/* XEN: Only map initial RAM allocation. */
    2.11 +						if (pfn >= max_ram_pfn)
    2.12 +							break;
    2.13  						if (pte_present(*pte))
    2.14  							continue;
    2.15  						if (is_kernel_text(address))
    2.16 @@ -627,6 +629,7 @@ void __init mem_init(void)
    2.17  	int codesize, reservedpages, datasize, initsize;
    2.18  	int tmp;
    2.19  	int bad_ppro;
    2.20 +	unsigned long pfn;
    2.21  
    2.22  #ifndef CONFIG_DISCONTIGMEM
    2.23  	if (!mem_map)
    2.24 @@ -655,6 +658,12 @@ void __init mem_init(void)
    2.25  
    2.26  	/* this will put all low memory onto the freelists */
    2.27  	totalram_pages += __free_all_bootmem();
    2.28 +	/* XEN: init and count low-mem pages outside initial allocation. */
    2.29 +	for (pfn = xen_start_info.nr_pages; pfn < max_low_pfn; pfn++) {
    2.30 +		ClearPageReserved(&mem_map[pfn]);
    2.31 +		atomic_set(&mem_map[pfn].count, 1);
    2.32 +		totalram_pages++;
    2.33 +	}
    2.34  
    2.35  	reservedpages = 0;
    2.36  	for (tmp = 0; tmp < max_low_pfn; tmp++)
     3.1 --- a/xen/arch/x86/domain.c	Fri Feb 25 01:18:50 2005 +0000
     3.2 +++ b/xen/arch/x86/domain.c	Sat Feb 26 18:18:12 2005 +0000
     3.3 @@ -764,6 +764,7 @@ int construct_dom0(struct domain *p,
     3.4      printk("done.\n");
     3.5  
     3.6      /* Construct a frame-allocation list for the initial domain. */
     3.7 +    p->max_pages = ~0U;
     3.8      for ( mfn = (alloc_start>>PAGE_SHIFT); 
     3.9            mfn < (alloc_end>>PAGE_SHIFT); 
    3.10            mfn++ )
    3.11 @@ -773,7 +774,7 @@ int construct_dom0(struct domain *p,
    3.12          page->u.inuse.type_info = 0;
    3.13          page->count_info        = PGC_allocated | 1;
    3.14          list_add_tail(&page->list, &p->page_list);
    3.15 -        p->tot_pages++; p->max_pages++;
    3.16 +        p->tot_pages++; 
    3.17      }
    3.18  
    3.19      mpt_alloc = (vpt_start - dsi.v_start) + alloc_start;