From 763826feff1e481210182d591837e44cde687564 Mon Sep 17 00:00:00 2001 From: alc Date: Wed, 8 Nov 2006 18:43:47 +0000 Subject: 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(). --- sys/vm/vm_page.c | 14 ++++++++++++-- 1 file 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", -- cgit v1.1