summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-12-01 15:46:40 +0000
committerdyson <dyson@FreeBSD.org>1996-12-01 15:46:40 +0000
commite30058b4a4dd11ef7501554cdb4106efae507b72 (patch)
tree5d46730dbe57f096f9b6410f00673dbbb7b9600f /sys
parent5ad469713ddacb2f95b669bcc2cc9f70bd2294cc (diff)
downloadFreeBSD-src-e30058b4a4dd11ef7501554cdb4106efae507b72.zip
FreeBSD-src-e30058b4a4dd11ef7501554cdb4106efae507b72.tar.gz
Fix a problem with the new buffer_map management code. Additionally,
decrease the size of buffer_map to approx 2/3 of what it used to be (buffer_map can be smaller now.) The original commit of these changes increased the size of buffer_map to the point where the system would not boot on large systems -- now large systems with large caches will have even less problems than before.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/machdep.c6
-rw-r--r--sys/i386/i386/machdep.c6
-rw-r--r--sys/kern/vfs_bio.c38
3 files changed, 30 insertions, 20 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 0992151..c5d0645 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.213 1996/11/29 13:12:14 bde Exp $
+ * $Id: machdep.c,v 1.214 1996/11/29 13:19:26 bde Exp $
*/
#include "npx.h"
@@ -322,7 +322,7 @@ again:
#ifdef BOUNCE_BUFFERS
clean_map = kmem_suballoc(kernel_map, &clean_sva, &clean_eva,
- (nbuf*MAXBSIZE) + (nswbuf*MAXPHYS) +
+ (3*nbuf*DFLTBSIZE/2) + (nswbuf*MAXPHYS) +
maxbkva + pager_map_size, TRUE);
io_map = kmem_suballoc(clean_map, &minaddr, &maxaddr, maxbkva, FALSE);
#else
@@ -330,7 +330,7 @@ again:
(nbuf*MAXBSIZE) + (nswbuf*MAXPHYS) + pager_map_size, TRUE);
#endif
buffer_map = kmem_suballoc(clean_map, &buffer_sva, &buffer_eva,
- (nbuf*MAXBSIZE), TRUE);
+ (3*nbuf*DFLTBSIZE/2), TRUE);
pager_map = kmem_suballoc(clean_map, &pager_sva, &pager_eva,
(nswbuf*MAXPHYS) + pager_map_size, TRUE);
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 0992151..c5d0645 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.213 1996/11/29 13:12:14 bde Exp $
+ * $Id: machdep.c,v 1.214 1996/11/29 13:19:26 bde Exp $
*/
#include "npx.h"
@@ -322,7 +322,7 @@ again:
#ifdef BOUNCE_BUFFERS
clean_map = kmem_suballoc(kernel_map, &clean_sva, &clean_eva,
- (nbuf*MAXBSIZE) + (nswbuf*MAXPHYS) +
+ (3*nbuf*DFLTBSIZE/2) + (nswbuf*MAXPHYS) +
maxbkva + pager_map_size, TRUE);
io_map = kmem_suballoc(clean_map, &minaddr, &maxaddr, maxbkva, FALSE);
#else
@@ -330,7 +330,7 @@ again:
(nbuf*MAXBSIZE) + (nswbuf*MAXPHYS) + pager_map_size, TRUE);
#endif
buffer_map = kmem_suballoc(clean_map, &buffer_sva, &buffer_eva,
- (nbuf*MAXBSIZE), TRUE);
+ (3*nbuf*DFLTBSIZE/2), TRUE);
pager_map = kmem_suballoc(clean_map, &pager_sva, &pager_eva,
(nswbuf*MAXPHYS) + pager_map_size, TRUE);
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a653395..4bd5bcf 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.106 1996/11/28 04:26:04 dyson Exp $
+ * $Id: vfs_bio.c,v 1.107 1996/11/30 22:41:40 dyson Exp $
*/
/*
@@ -954,15 +954,23 @@ fillbuf:
bp->b_usecount = 4;
maxsize = (maxsize + PAGE_MASK) & ~PAGE_MASK;
- bfreekva(bp);
-
+
/*
- * See if we have buffer kva space
+ * we assume that buffer_map is not at address 0
*/
- if (vm_map_findspace(buffer_map, 0, maxsize, &addr)) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- goto trytofreespace;
+ addr = 0;
+ if (maxsize != bp->b_kvasize) {
+ bfreekva(bp);
+
+ /*
+ * See if we have buffer kva space
+ */
+ if (vm_map_findspace(buffer_map,
+ vm_map_min(buffer_map), maxsize, &addr)) {
+ bp->b_flags |= B_INVAL;
+ brelse(bp);
+ goto trytofreespace;
+ }
}
/*
@@ -978,13 +986,15 @@ fillbuf:
* create a map entry for the buffer -- in essence
* reserving the kva space.
*/
- vm_map_insert(buffer_map, NULL, 0,
- addr, addr + maxsize,
- VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
+ if (addr) {
+ vm_map_insert(buffer_map, NULL, 0,
+ addr, addr + maxsize,
+ VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
- bp->b_data = (caddr_t) addr;
- bp->b_kvabase = (caddr_t) addr;
- bp->b_kvasize = maxsize;
+ bp->b_kvabase = (caddr_t) addr;
+ bp->b_kvasize = maxsize;
+ }
+ bp->b_data = bp->b_kvabase;
return (bp);
}
OpenPOWER on IntegriCloud