Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Make this actually work if the BUFCACHE option is n...
details: https://anonhg.NetBSD.org/src/rev/dce3023b0c5f
branches: trunk
changeset: 473115:dce3023b0c5f
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu May 20 20:01:28 1999 +0000
description:
Make this actually work if the BUFCACHE option is not specified, by falling
back on the traditional BSD formula of 10% of first 2MB and 5% of remaining.
diffstat:
sys/kern/kern_allocsys.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r 01abe5f9fdd2 -r dce3023b0c5f sys/kern/kern_allocsys.c
--- a/sys/kern/kern_allocsys.c Thu May 20 19:56:49 1999 +0000
+++ b/sys/kern/kern_allocsys.c Thu May 20 20:01:28 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_allocsys.c,v 1.1 1999/05/20 05:59:52 lukem Exp $ */
+/* $NetBSD: kern_allocsys.c,v 1.2 1999/05/20 20:01:28 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -107,6 +107,7 @@
# error BUFCACHE is not between 5 and 95
# endif
#else
+ /* Default to 10% of first 2MB and 5% of remaining. */
# define BUFCACHE 0
#endif
@@ -151,11 +152,25 @@
/*
* Determine how many buffers to allocate.
- * We allocate bufcache % of memory for buffer space.
+ *
+ * - If bufcache is specified, use that % of memory
+ * for the buffer cache.
+ *
+ * - Otherwise, we default to the traditional BSD
+ * formula of 10% of the first 2MB and 5% of
+ * the remaining.
*/
-
- if (bufpages == 0)
- bufpages = physmem / CLSIZE * bufcache / 100;
+ if (bufpages == 0) {
+ if (bufcache != 0)
+ bufpages = physmem / CLSIZE * bufcache / 100;
+ else {
+ if (physmem < btoc(2 * 1024 * 1024))
+ bufpages = physmem / (10 * CLSIZE);
+ else
+ bufpages = (btoc(2 * 1024 * 1024) + physmem) /
+ (20 * CLSIZE);
+ }
+ }
#ifdef DIAGNOSTIC
if (bufpages == 0)
Home |
Main Index |
Thread Index |
Old Index