summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2007-05-05 19:50:28 +0000
committeralc <alc@FreeBSD.org>2007-05-05 19:50:28 +0000
commitb34f6f7ab1b2b31d561cfbfbc0b43a23c6d93a3e (patch)
tree7aa0cbd313dfa6ace4e0a35a84679f7d3492a165 /sys/vm/vm_page.c
parent5326cfc8d7152339e4530123781c6ad0d0a22261 (diff)
downloadFreeBSD-src-b34f6f7ab1b2b31d561cfbfbc0b43a23c6d93a3e.zip
FreeBSD-src-b34f6f7ab1b2b31d561cfbfbc0b43a23c6d93a3e.tar.gz
Define every architecture as either VM_PHYSSEG_DENSE or
VM_PHYSSEG_SPARSE depending on whether the physical address space is densely or sparsely populated with memory. The effect of this definition is to determine which of two implementations of vm_page_array and PHYS_TO_VM_PAGE() is used. The legacy implementation is obtained by defining VM_PHYSSEG_DENSE, and a new implementation that trades off time for space is obtained by defining VM_PHYSSEG_SPARSE. For now, all architectures except for ia64 and sparc64 define VM_PHYSSEG_DENSE. Defining VM_PHYSSEG_SPARSE on ia64 allows the entirety of my Itanium 2's memory to be used. Previously, only the first 1 GB could be used. Defining VM_PHYSSEG_SPARSE on sparc64 allows USIIIi-based systems to boot without crashing. This change is a combination of Nathan Whitehorn's patch and my own work in perforce. Discussed with: kmacy, marius, Nathan Whitehorn PR: 112194
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r--sys/vm/vm_page.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index e97eca9..d4f8148 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -298,7 +298,15 @@ vm_page_startup(vm_offset_t vaddr)
* page).
*/
first_page = low_water / PAGE_SIZE;
+#ifdef VM_PHYSSEG_SPARSE
+ page_range = 0;
+ for (i = 0; phys_avail[i + 1] != 0; i += 2)
+ page_range += atop(phys_avail[i + 1] - phys_avail[i]);
+#elif defined(VM_PHYSSEG_DENSE)
page_range = high_water / PAGE_SIZE - first_page;
+#else
+#error "Either VM_PHYSSEG_DENSE or VM_PHYSSEG_SPARSE must be defined."
+#endif
npages = (total - (page_range * sizeof(struct vm_page)) -
(end - new_end)) / PAGE_SIZE;
end = new_end;
OpenPOWER on IntegriCloud