summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2006-11-08 18:43:47 +0000
committeralc <alc@FreeBSD.org>2006-11-08 18:43:47 +0000
commit763826feff1e481210182d591837e44cde687564 (patch)
tree3d82e6138f7df000663997bc89097949a895c7bc /sys/vm
parent0b514365390be0be8ebb0007bde677bdddb3326e (diff)
downloadFreeBSD-src-763826feff1e481210182d591837e44cde687564.zip
FreeBSD-src-763826feff1e481210182d591837e44cde687564.tar.gz
Simplify the construction of the free queues in vm_page_startup(). Add
an assertion to test a hypothesis concerning other redundant computation in vm_page_startup().
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_page.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index c191d60..fabeec3 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -320,6 +320,16 @@ vm_page_startup(vm_offset_t vaddr)
phys_avail[biggestone + 1] = new_end;
/*
+ * This assertion tests the hypothesis that npages and total are
+ * redundant. XXX
+ */
+ page_range = 0;
+ for (i = 0; phys_avail[i + 1] != 0; i += 2)
+ page_range += atop(phys_avail[i + 1] - phys_avail[i]);
+ KASSERT(page_range == npages,
+ ("vm_page_startup: inconsistent page counts"));
+
+ /*
* Clear all of the page structures
*/
bzero((caddr_t) vm_page_array, page_range * sizeof(struct vm_page));
@@ -334,10 +344,10 @@ vm_page_startup(vm_offset_t vaddr)
cnt.v_page_count = 0;
cnt.v_free_count = 0;
list = getenv("vm.blacklist");
- for (i = 0; phys_avail[i + 1] && npages > 0; i += 2) {
+ for (i = 0; phys_avail[i + 1] != 0; i += 2) {
pa = phys_avail[i];
last_pa = phys_avail[i + 1];
- while (pa < last_pa && npages-- > 0) {
+ while (pa < last_pa) {
if (list != NULL &&
vm_page_blacklist_lookup(list, pa))
printf("Skipping page with pa 0x%jx\n",
OpenPOWER on IntegriCloud