Date: Thu, 16 Sep 2004 01:53:22 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 61582 for review Message-ID: <200409160153.i8G1rMHo013294@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=61582 Change 61582 by marcel@marcel_nfs on 2004/09/16 01:52:24 Revert the SPARSE_PHYSICAL_MEMORY changes. Affected files ... .. //depot/projects/ia64/sys/vm/vm_page.c#64 edit .. //depot/projects/ia64/sys/vm/vm_page.h#31 edit Differences ... ==== //depot/projects/ia64/sys/vm/vm_page.c#64 (text+ko) ==== @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/vm/vm_page.c,v 1.290 2004/07/29 18:56:31 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_page.c,v 1.291 2004/09/15 12:09:50 phk Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -148,30 +148,7 @@ panic("vm_set_page_size: page size not a power of two"); } -#ifdef SPARSE_PHYSICAL_MEMORY /* - * vm_page_from_phys - * - * Given a physical address, return a pointer to the vm_page in the - * vm_page array. This function deals with sparse memory addresses. - */ -vm_page_t -vm_page_from_phys(vm_offset_t pa) -{ - vm_page_t p = vm_page_array; - int i; - - for (i = 0; phys_avail[i + 1]; i += 2) { - if (pa >= phys_avail[i] && pa < phys_avail[i + 1]) - return (p + (atop(pa) - phys_avail[i] / PAGE_SIZE)); - p += (phys_avail[i + 1] - phys_avail[i]) / PAGE_SIZE; - } - panic("vm_page_from_phys: unmanaged physical address."); - return (0); -} -#endif - -/* * vm_page_startup: * * Initializes the resident memory module. @@ -211,7 +188,6 @@ phys_avail[i + 1] = trunc_page(phys_avail[i + 1]); } - /* XXX: Based on assumptions that aren't valid on all architectures.*/ for (i = 0; phys_avail[i + 1]; i += 2) { vm_paddr_t size = phys_avail[i + 1] - phys_avail[i]; @@ -246,8 +222,8 @@ bootpages = UMA_BOOT_PAGES * UMA_SLAB_SIZE; new_end = end - bootpages; new_end = trunc_page(new_end); - /* XXX: Bounds check! */ - mapped = pmap_map(&vaddr, new_end, end, VM_PROT_READ | VM_PROT_WRITE); + mapped = pmap_map(&vaddr, new_end, end, + VM_PROT_READ | VM_PROT_WRITE); bzero((caddr_t) mapped, end - new_end); uma_startup((caddr_t)mapped); @@ -257,16 +233,7 @@ * page). */ first_page = phys_avail[0] / PAGE_SIZE; -#ifdef SPARSE_PHYSICAL_MEMORY - /* - * Don't use the pysical address range for the actual page range. - * On architectures with sparse memory addressing this is wrong. - * Instead, use the total memory obtained above. - */ - page_range = total / PAGE_SIZE; -#else - page_range = phys_avail[(nblocks-1) * 2 + 1] / PAGE_SIZE - first_page; -#endif + page_range = phys_avail[(nblocks - 1) * 2 + 1] / PAGE_SIZE - first_page; npages = (total - (page_range * sizeof(struct vm_page)) - (end - new_end)) / PAGE_SIZE; end = new_end; @@ -281,8 +248,8 @@ * queue. */ new_end = trunc_page(end - page_range * sizeof(struct vm_page)); - /* XXX: Bounds check! */ - mapped = pmap_map(&vaddr, new_end, end, VM_PROT_READ | VM_PROT_WRITE); + mapped = pmap_map(&vaddr, new_end, end, + VM_PROT_READ | VM_PROT_WRITE); vm_page_array = (vm_page_t) mapped; phys_avail[biggestone + 1] = new_end; @@ -296,7 +263,7 @@ * Construct the free queue(s) in descending order (by physical * address) so that the first 16MB of physical memory is allocated * last rather than first. On large-memory machines, this avoids - * the exhaustion of low physical memory before isa_dmainit has run. + * the exhaustion of low physical memory before isa_dma_init has run. */ cnt.v_page_count = 0; cnt.v_free_count = 0; ==== //depot/projects/ia64/sys/vm/vm_page.h#31 (text+ko) ==== @@ -290,11 +290,8 @@ #define VM_PAGE_TO_PHYS(entry) ((entry)->phys_addr) -#ifdef SPARSE_PHYSICAL_MEMORY -#define PHYS_TO_VM_PAGE(pa) vm_page_from_phys(pa) -#else -#define PHYS_TO_VM_PAGE(pa) (&vm_page_array[atop(pa) - first_page ]) -#endif +#define PHYS_TO_VM_PAGE(pa) \ + (&vm_page_array[atop(pa) - first_page ]) extern struct mtx vm_page_queue_mtx; #define vm_page_lock_queues() mtx_lock(&vm_page_queue_mtx) @@ -360,7 +357,6 @@ void vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t); vm_page_t vm_page_select_cache(int); vm_page_t vm_page_splay(vm_pindex_t, vm_page_t); -vm_page_t vm_page_from_phys(vm_offset_t); vm_offset_t vm_page_startup(vm_offset_t vaddr); void vm_page_unmanage (vm_page_t); void vm_page_unwire (vm_page_t, int);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409160153.i8G1rMHo013294>