From c4a6405c88157159ca351597cf83c1a4e5502fbd Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 2 Jul 2008 05:41:23 +0000 Subject: [PATCH] Eliminate an unnecessary static variable: nkpt. --- sys/amd64/amd64/pmap.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 2d33c2a575de..a8c0b3c44ab8 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -173,7 +173,6 @@ struct pmap kernel_pmap_store; vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ -static int nkpt; static int ndmpdp; static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end; @@ -543,7 +542,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) kernel_pmap->pm_root = NULL; kernel_pmap->pm_active = -1; /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvchunk); - nkpt = NKPT; /* * Reserve some special page table entries/VA space for temporary @@ -650,7 +648,7 @@ pmap_init(void) * page table pages. */ pd = pmap_pde(kernel_pmap, VM_MIN_KERNEL_ADDRESS); - for (i = 0; i < nkpt; i++) { + for (i = 0; i < NKPT; i++) { if ((pd[i] & (PG_PS | PG_V)) == (PG_PS | PG_V)) continue; mpte = PHYS_TO_VM_PAGE(pd[i] & PG_FRAME); @@ -1708,10 +1706,8 @@ pmap_growkernel(vm_offset_t addr) mtx_assert(&kernel_map->system_mtx, MA_OWNED); if (kernel_vm_end == 0) { kernel_vm_end = VM_MIN_KERNEL_ADDRESS; - nkpt = 0; while ((*pmap_pde(kernel_pmap, kernel_vm_end) & PG_V) != 0) { kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1); - nkpt++; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; break; @@ -1725,7 +1721,7 @@ pmap_growkernel(vm_offset_t addr) pde = pmap_pde(kernel_pmap, kernel_vm_end); if (pde == NULL) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, nkpt, + nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDPSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); @@ -1749,9 +1745,6 @@ pmap_growkernel(vm_offset_t addr) VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - - nkpt++; - pmap_zero_page(nkpg); paddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (paddr | PG_V | PG_RW | PG_A | PG_M);