Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys - bringing kmeminit_nkmempages back and revert pmaps tha...
details: https://anonhg.NetBSD.org/src/rev/93a977ff305c
branches: trunk
changeset: 773459:93a977ff305c
user: para <para%NetBSD.org@localhost>
date: Thu Feb 02 18:59:44 2012 +0000
description:
- bringing kmeminit_nkmempages back and revert pmaps that called this early
- use nkmempages to scale the kmem_arena
- reducing diff to pre kmem/vmem change
(NKMEMPAGES_MAX_DEFAULT will need adjusting on some archs)
diffstat:
sys/arch/alpha/alpha/pmap.c | 11 +++++-
sys/arch/mips/mips/pmap.c | 11 +++++-
sys/arch/powerpc/booke/booke_pmap.c | 11 +++++-
sys/arch/vax/vax/pmap.c | 11 +++++-
sys/uvm/uvm_extern.h | 5 +-
sys/uvm/uvm_km.c | 58 ++++++++++++++++++++++++++++++++++--
6 files changed, 90 insertions(+), 17 deletions(-)
diffs (272 lines):
diff -r 8f7decea85ad -r 93a977ff305c sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c Thu Feb 02 18:33:03 2012 +0000
+++ b/sys/arch/alpha/alpha/pmap.c Thu Feb 02 18:59:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.256 2012/01/27 19:48:38 para Exp $ */
+/* $NetBSD: pmap.c,v 1.257 2012/02/02 18:59:44 para Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc.
@@ -140,7 +140,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.256 2012/01/27 19:48:38 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.257 2012/02/02 18:59:44 para Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -757,6 +757,11 @@
#endif
/*
+ * Compute the number of pages kmem_arena will have.
+ */
+ kmeminit_nkmempages();
+
+ /*
* Figure out how many initial PTE's are necessary to map the
* kernel. We also reserve space for kmem_alloc_pageable()
* for vm_fork().
@@ -769,7 +774,7 @@
lev3mapsize =
(VM_PHYS_SIZE + (ubc_nwins << ubc_winshift) +
bufsz + 16 * NCARGS + pager_map_size) / PAGE_SIZE +
- (maxproc * UPAGES) + (256 * 1024 * 1024) / PAGE_SIZE;
+ (maxproc * UPAGES) + nkmempages;
#ifdef SYSVSHM
lev3mapsize += shminfo.shmall;
diff -r 8f7decea85ad -r 93a977ff305c sys/arch/mips/mips/pmap.c
--- a/sys/arch/mips/mips/pmap.c Thu Feb 02 18:33:03 2012 +0000
+++ b/sys/arch/mips/mips/pmap.c Thu Feb 02 18:59:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.206 2012/01/27 19:48:39 para Exp $ */
+/* $NetBSD: pmap.c,v 1.207 2012/02/02 18:59:44 para Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.206 2012/01/27 19:48:39 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207 2012/02/02 18:59:44 para Exp $");
/*
* Manages physical address maps.
@@ -496,6 +496,11 @@
pmap_tlb_info_init(&pmap_tlb0_info); /* init the lock */
/*
+ * Compute the number of pages kmem_arena will have.
+ */
+ kmeminit_nkmempages();
+
+ /*
* Figure out how many PTE's are necessary to map the kernel.
* We also reserve space for kmem_alloc_pageable() for vm_fork().
*/
@@ -507,7 +512,7 @@
Sysmapsize = (VM_PHYS_SIZE + (ubc_nwins << ubc_winshift) +
bufsz + 16 * NCARGS + pager_map_size + iospace_size) / NBPG +
- (maxproc * UPAGES) + 1024 * 1024;
+ (maxproc * UPAGES) + nkmempages;
#ifdef DEBUG
{
extern int kmem_guard_depth;
diff -r 8f7decea85ad -r 93a977ff305c sys/arch/powerpc/booke/booke_pmap.c
--- a/sys/arch/powerpc/booke/booke_pmap.c Thu Feb 02 18:33:03 2012 +0000
+++ b/sys/arch/powerpc/booke/booke_pmap.c Thu Feb 02 18:59:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: booke_pmap.c,v 1.11 2012/01/27 19:48:39 para Exp $ */
+/* $NetBSD: booke_pmap.c,v 1.12 2012/02/02 18:59:44 para Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.11 2012/01/27 19:48:39 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.12 2012/02/02 18:59:44 para Exp $");
#include <sys/param.h>
#include <sys/kcore.h>
@@ -146,6 +146,11 @@
pmap_tlb_info_init(&pmap_tlb0_info); /* init the lock */
/*
+ * Compute the number of pages kmem_arena will have.
+ */
+ kmeminit_nkmempages();
+
+ /*
* Figure out how many PTE's are necessary to map the kernel.
* We also reserve space for kmem_alloc_pageable() for vm_fork().
*/
@@ -164,7 +169,7 @@
#ifdef SYSVSHM
+ NBPG * shminfo.shmall
#endif
- + NBPG * 32 * 1024);
+ + NBPG * nkmempages);
/*
* Initialize `FYI' variables. Note we're relying on
diff -r 8f7decea85ad -r 93a977ff305c sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c Thu Feb 02 18:33:03 2012 +0000
+++ b/sys/arch/vax/vax/pmap.c Thu Feb 02 18:59:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.181 2012/02/02 14:30:13 matt Exp $ */
+/* $NetBSD: pmap.c,v 1.182 2012/02/02 18:59:44 para Exp $ */
/*
* Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.181 2012/02/02 14:30:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.182 2012/02/02 18:59:44 para Exp $");
#include "opt_ddb.h"
#include "opt_cputype.h"
@@ -224,12 +224,19 @@
{
vsize_t kvmsize, bufsz;
+ /*
+ * Compute the number of pages kmem_arena will have.
+ */
+ kmeminit_nkmempages();
+
/* All physical memory */
kvmsize = avail_end;
/* User Page table area. This may be large */
kvmsize += (usrptsize * sizeof(struct pte));
/* Kernel stacks per process */
kvmsize += (USPACE * maxproc);
+ /* kernel malloc arena */
+ kvmsize += nkmempages * PAGE_SIZE;
/* IO device register space */
kvmsize += (IOSPSZ * VAX_NBPG);
/* Pager allocations */
diff -r 8f7decea85ad -r 93a977ff305c sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Thu Feb 02 18:33:03 2012 +0000
+++ b/sys/uvm/uvm_extern.h Thu Feb 02 18:59:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.180 2012/01/27 19:48:41 para Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.181 2012/02/02 18:59:45 para Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -749,8 +749,9 @@
bool uvn_needs_writefault_p(struct uvm_object *);
/* kern_malloc.c */
+void kmeminit_nkmempages(void);
void kmeminit(void);
-void kmeminit_nkmempages(void);
+extern int nkmempages;
#endif /* _KERNEL */
diff -r 8f7decea85ad -r 93a977ff305c sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c Thu Feb 02 18:33:03 2012 +0000
+++ b/sys/uvm/uvm_km.c Thu Feb 02 18:59:44 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_km.c,v 1.116 2012/02/01 23:43:49 para Exp $ */
+/* $NetBSD: uvm_km.c,v 1.117 2012/02/02 18:59:45 para Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -120,10 +120,29 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.116 2012/02/01 23:43:49 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.117 2012/02/02 18:59:45 para Exp $");
#include "opt_uvmhist.h"
+#include "opt_kmempages.h"
+
+#ifndef NKMEMPAGES
+#define NKMEMPAGES 0
+#endif
+
+/*
+ * Defaults for lower and upper-bounds for the kmem_arena page count.
+ * Can be overridden by kernel config options.
+ */
+#ifndef NKMEMPAGES_MIN
+#define NKMEMPAGES_MIN NKMEMPAGES_MIN_DEFAULT
+#endif
+
+#ifndef NKMEMPAGES_MAX
+#define NKMEMPAGES_MAX NKMEMPAGES_MAX_DEFAULT
+#endif
+
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
@@ -147,6 +166,7 @@
static struct vm_map_entry kernel_image_mapent_store;
static struct vm_map_entry kernel_kmem_mapent_store;
+int nkmempages = 0;
vaddr_t kmembase;
vsize_t kmemsize;
@@ -154,6 +174,33 @@
vmem_t *kmem_va_arena;
/*
+ * kmeminit_nkmempages: calculate the size of kmem_arena.
+ */
+void
+kmeminit_nkmempages(void)
+{
+ int npages;
+
+ if (nkmempages != 0) {
+ /*
+ * It's already been set (by us being here before)
+ * bail out now;
+ */
+ return;
+ }
+
+ npages = physmem;
+
+ if (npages > NKMEMPAGES_MAX)
+ npages = NKMEMPAGES_MAX;
+
+ if (npages < NKMEMPAGES_MIN)
+ npages = NKMEMPAGES_MIN;
+
+ nkmempages = npages;
+}
+
+/*
* uvm_km_bootstrap: init kernel maps and objects to reflect reality (i.e.
* KVM already allocated for text, data, bss, and static data structures).
*
@@ -167,9 +214,12 @@
{
vaddr_t base = VM_MIN_KERNEL_ADDRESS;
- kmemsize = MIN((((vsize_t)(end - start)) / 3),
+ kmeminit_nkmempages();
+ kmemsize = nkmempages * PAGE_SIZE;
+
+ /* kmemsize = MIN((((vsize_t)(end - start)) / 3),
((((vsize_t)uvmexp.npages) * PAGE_SIZE) / 2));
- kmemsize = round_page(kmemsize);
+ kmemsize = round_page(kmemsize); */
/*
* next, init kernel memory objects.
Home |
Main Index |
Thread Index |
Old Index