Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys improve sizing of kmem_arena now that more allocations a...
details: https://anonhg.NetBSD.org/src/rev/8471b86227c7
branches: trunk
changeset: 773511:8471b86227c7
user: para <para%NetBSD.org@localhost>
date: Sat Feb 04 17:56:16 2012 +0000
description:
improve sizing of kmem_arena now that more allocations are made from it
don't enforce limits if not required
ok: riz@
diffstat:
sys/arch/amd64/include/param.h | 7 ++++---
sys/arch/arm/include/arm32/param.h | 6 +++---
sys/arch/hppa/include/param.h | 4 ++--
sys/arch/i386/include/param.h | 4 ++--
sys/arch/sparc64/include/param.h | 9 +++++----
sys/uvm/uvm_km.c | 23 ++++++++++++++---------
6 files changed, 30 insertions(+), 23 deletions(-)
diffs (173 lines):
diff -r d8915f949f55 -r 8471b86227c7 sys/arch/amd64/include/param.h
--- a/sys/arch/amd64/include/param.h Sat Feb 04 17:05:38 2012 +0000
+++ b/sys/arch/amd64/include/param.h Sat Feb 04 17:56:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.16 2012/01/24 20:03:36 christos Exp $ */
+/* $NetBSD: param.h,v 1.17 2012/02/04 17:56:16 para Exp $ */
#ifdef __x86_64__
@@ -81,11 +81,12 @@
#endif
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Minimum size of the kernel kmem_arena in PAGE_SIZE-sized
* logical pages.
+ * No enforced maximum on amd64.
*/
#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
-#define NKMEMPAGES_MAX_DEFAULT ((1 *1024 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MAX_UNLIMITED 1
/*
* XXXfvdl the PD* stuff is different from i386.
diff -r d8915f949f55 -r 8471b86227c7 sys/arch/arm/include/arm32/param.h
--- a/sys/arch/arm/include/arm32/param.h Sat Feb 04 17:05:38 2012 +0000
+++ b/sys/arch/arm/include/arm32/param.h Sat Feb 04 17:56:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.16 2011/01/14 02:06:24 rmind Exp $ */
+/* $NetBSD: param.h,v 1.17 2012/02/04 17:56:16 para Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe.
@@ -64,8 +64,8 @@
* Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
* logical pages.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT)
-#define NKMEMPAGES_MAX_DEFAULT ((7 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
/* Constants used to divide the USPACE area */
diff -r d8915f949f55 -r 8471b86227c7 sys/arch/hppa/include/param.h
--- a/sys/arch/hppa/include/param.h Sat Feb 04 17:05:38 2012 +0000
+++ b/sys/arch/hppa/include/param.h Sat Feb 04 17:56:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.17 2012/01/24 20:03:36 christos Exp $ */
+/* $NetBSD: param.h,v 1.18 2012/02/04 17:56:16 para Exp $ */
/* $OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $ */
@@ -83,7 +83,7 @@
* Size of kernel malloc arena in logical pages
*/
#define NKMEMPAGES_MIN_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT)
-#define NKMEMPAGES_MAX_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
/*
* Mach derived conversion macros
diff -r d8915f949f55 -r 8471b86227c7 sys/arch/i386/include/param.h
--- a/sys/arch/i386/include/param.h Sat Feb 04 17:05:38 2012 +0000
+++ b/sys/arch/i386/include/param.h Sat Feb 04 17:56:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.74 2012/01/24 20:03:37 christos Exp $ */
+/* $NetBSD: param.h,v 1.75 2012/02/04 17:56:16 para Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -129,7 +129,7 @@
* logical pages.
*/
#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
-#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MAX_DEFAULT ((280 * 1024 * 1024) >> PAGE_SHIFT)
/*
* Mach derived conversion macros
diff -r d8915f949f55 -r 8471b86227c7 sys/arch/sparc64/include/param.h
--- a/sys/arch/sparc64/include/param.h Sat Feb 04 17:05:38 2012 +0000
+++ b/sys/arch/sparc64/include/param.h Sat Feb 04 17:56:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.47 2012/01/24 20:03:38 christos Exp $ */
+/* $NetBSD: param.h,v 1.48 2012/02/04 17:56:16 para Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -193,11 +193,12 @@
#define MSGBUFSIZE NBPG
/*
- * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized
+ * Minimum size of the kernel kmem_arena in PAGE_SIZE-sized
* logical pages.
+ * No enforced maximum on sparc64.
*/
-#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT)
-#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MIN_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
+#define NKMEMPAGES_MAX_UNLIMITED 1
#ifdef _KERNEL
#ifndef _LOCORE
diff -r d8915f949f55 -r 8471b86227c7 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c Sat Feb 04 17:05:38 2012 +0000
+++ b/sys/uvm/uvm_km.c Sat Feb 04 17:56:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_km.c,v 1.118 2012/02/03 19:25:07 matt Exp $ */
+/* $NetBSD: uvm_km.c,v 1.119 2012/02/04 17:56:17 para Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -120,7 +120,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.118 2012/02/03 19:25:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.119 2012/02/04 17:56:17 para Exp $");
#include "opt_uvmhist.h"
@@ -189,10 +189,16 @@
return;
}
- npages = physmem;
+#if defined(PMAP_MAP_POOLPAGE)
+ npages = (physmem / 4);
+#else
+ npages = (physmem / 3) * 2;
+#endif /* defined(PMAP_MAP_POOLPAGE) */
+#ifndef NKMEMPAGES_MAX_UNLIMITED
if (npages > NKMEMPAGES_MAX)
npages = NKMEMPAGES_MAX;
+#endif
if (npages < NKMEMPAGES_MIN)
npages = NKMEMPAGES_MIN;
@@ -212,6 +218,7 @@
void
uvm_km_bootstrap(vaddr_t start, vaddr_t end)
{
+ bool kmem_arena_small;
vaddr_t base = VM_MIN_KERNEL_ADDRESS;
struct uvm_map_args args;
int error;
@@ -221,11 +228,8 @@
start, end, 0,0);
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 = (vsize_t)nkmempages * PAGE_SIZE;
+ kmem_arena_small = kmemsize < 64 * 1024 * 1024;
UVMHIST_LOG(maphist, "kmemsize=%#"PRIxVSIZE, kmemsize, 0,0,0);
@@ -301,7 +305,8 @@
kmem_va_arena = vmem_create("kva", 0, 0, PAGE_SIZE,
vmem_alloc, vmem_free, kmem_arena,
- 16 * PAGE_SIZE, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM);
+ (kmem_arena_small ? 4 : 16) * PAGE_SIZE,
+ VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM);
UVMHIST_LOG(maphist, "<- done", 0,0,0,0);
}
Home |
Main Index |
Thread Index |
Old Index