From 20b553ba68ba8998038524a15f305a33c733a2b4 Mon Sep 17 00:00:00 2001 From: dyson Date: Sun, 17 Nov 1996 02:11:01 +0000 Subject: [PATCH] Improve the caching of small files like directories, while not substantially increasing buffer space. Specifically, we double the number of buffers, but allocate only half the amount of memory per buffer. Note that VDIR files aren't cached unless instantiated in a buffer. This will significantly improve caching. --- sys/amd64/amd64/machdep.c | 6 +++--- sys/i386/i386/machdep.c | 6 +++--- sys/kern/vfs_bio.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 6082eec0f56b..0746c66c1625 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.210 1996/11/07 14:43:59 joerg Exp $ + * $Id: machdep.c,v 1.211 1996/11/11 20:38:52 bde Exp $ */ #include "npx.h" @@ -282,9 +282,9 @@ again: if (nbuf == 0) { nbuf = 30; if( physmem > 1024) - nbuf += min((physmem - 1024) / 12, 1024); + nbuf += min((physmem - 1024) / 6, 2048); } - nswbuf = min(nbuf, 128); + nswbuf = max(min(nbuf/4, 128), 16); valloc(swbuf, struct buf, nswbuf); valloc(buf, struct buf, nbuf); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 6082eec0f56b..0746c66c1625 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.210 1996/11/07 14:43:59 joerg Exp $ + * $Id: machdep.c,v 1.211 1996/11/11 20:38:52 bde Exp $ */ #include "npx.h" @@ -282,9 +282,9 @@ again: if (nbuf == 0) { nbuf = 30; if( physmem > 1024) - nbuf += min((physmem - 1024) / 12, 1024); + nbuf += min((physmem - 1024) / 6, 2048); } - nswbuf = min(nbuf, 128); + nswbuf = max(min(nbuf/4, 128), 16); valloc(swbuf, struct buf, nswbuf); valloc(buf, struct buf, nbuf); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index f931f6d38b1a..8b27a286e62d 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -18,7 +18,7 @@ * 5. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: vfs_bio.c,v 1.103 1996/10/06 07:50:05 dyson Exp $ + * $Id: vfs_bio.c,v 1.104 1996/10/17 03:04:43 dyson Exp $ */ /* @@ -155,7 +155,7 @@ bufinit() * cache is still the same as it would be for 8K filesystems. This * keeps the size of the buffer cache "in check" for big block filesystems. */ - maxbufspace = 2 * (nbuf + 8) * PAGE_SIZE; + maxbufspace = (nbuf + 8) * PAGE_SIZE; /* * reserve 1/3 of the buffers for metadata (VDIR) which might not be VMIO'ed */