From fcf37ac3378d3a003be60737392ead2e4d37a2fa Mon Sep 17 00:00:00 2001 From: Luoqi Chen Date: Fri, 8 Jan 1999 14:20:54 +0000 Subject: [PATCH] Allocate kernel page table object (kptobj) before any kmem_alloc calls. On a system with a large amount of ram (e.g. 2G), allocation of per-page data structures (512K physical pages) could easily bust the initial kernel page table (36M), and growth of kernel page table requires kptobj. --- sys/amd64/amd64/pmap.c | 11 ++++++----- sys/i386/i386/pmap.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 79cc809db31..92c3d2e3328 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.215 1998/12/07 21:58:18 archie Exp $ + * $Id: pmap.c,v 1.216 1999/01/07 22:15:51 dt Exp $ */ /* @@ -605,6 +605,11 @@ pmap_init(phys_start, phys_end) int i; int initial_pvs; + /* + * object for kernel page table pages + */ + kptobj = vm_object_allocate(OBJT_DEFAULT, NKPDE); + /* * calculate the number of pv_entries needed */ @@ -639,10 +644,6 @@ pmap_init(phys_start, phys_end) pvinit = (struct pv_entry *) kmem_alloc(kernel_map, initial_pvs * sizeof (struct pv_entry)); zbootinit(pvzone, "PV ENTRY", sizeof (struct pv_entry), pvinit, pv_npg); - /* - * object for kernel page table pages - */ - kptobj = vm_object_allocate(OBJT_DEFAULT, NKPDE); /* * Now it is safe to enable pv_table recording. diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 79cc809db31..92c3d2e3328 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * $Id: pmap.c,v 1.215 1998/12/07 21:58:18 archie Exp $ + * $Id: pmap.c,v 1.216 1999/01/07 22:15:51 dt Exp $ */ /* @@ -605,6 +605,11 @@ pmap_init(phys_start, phys_end) int i; int initial_pvs; + /* + * object for kernel page table pages + */ + kptobj = vm_object_allocate(OBJT_DEFAULT, NKPDE); + /* * calculate the number of pv_entries needed */ @@ -639,10 +644,6 @@ pmap_init(phys_start, phys_end) pvinit = (struct pv_entry *) kmem_alloc(kernel_map, initial_pvs * sizeof (struct pv_entry)); zbootinit(pvzone, "PV ENTRY", sizeof (struct pv_entry), pvinit, pv_npg); - /* - * object for kernel page table pages - */ - kptobj = vm_object_allocate(OBJT_DEFAULT, NKPDE); /* * Now it is safe to enable pv_table recording.