From 86f14493107324f33ce2d79e0dcbc2a9f7326755 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 2 Jan 2008 08:54:39 +0000 Subject: [PATCH] Provide a legitimate pindex to vm_page_alloc() in pmap_growkernel() instead of writing apologetic comments. As it turns out, I need every kernel page table page to have a legitimate pindex to support superpage promotion on kernel memory. Correct a nearby style error: Pointers should be compared to NULL. --- sys/amd64/amd64/pmap.c | 9 +++------ sys/i386/i386/pmap.c | 7 ++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index e0c5e9ac7dce..ed2f808a5632 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1554,7 +1554,7 @@ pmap_growkernel(vm_offset_t addr) /* We need a new PDP entry */ nkpg = vm_page_alloc(NULL, nkpt, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); pmap_zero_page(nkpg); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -1572,12 +1572,9 @@ pmap_growkernel(vm_offset_t addr) continue; } - /* - * This index is bogus, but out of the way - */ - nkpg = vm_page_alloc(NULL, nkpt, + nkpg = vm_page_alloc(NULL, pmap_pde_pindex(kernel_vm_end), VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpt++; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index fb46c357d75c..93e841dbcfa3 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -1619,12 +1619,9 @@ pmap_growkernel(vm_offset_t addr) continue; } - /* - * This index is bogus, but out of the way - */ - nkpg = vm_page_alloc(NULL, nkpt, + nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); - if (!nkpg) + if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpt++;