diff options
author | dyson <dyson@FreeBSD.org> | 1996-11-30 22:41:49 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1996-11-30 22:41:49 +0000 |
commit | 7a58275f33a773bf61557817714efe27f3611aaf (patch) | |
tree | c2414524de2607538eaf1294e5d9ee92fc65c8d6 /sys/vm/vm_pager.c | |
parent | 7c59df49d939e5f564cc78e9a17c7d2393e11420 (diff) | |
download | FreeBSD-src-7a58275f33a773bf61557817714efe27f3611aaf.zip FreeBSD-src-7a58275f33a773bf61557817714efe27f3611aaf.tar.gz |
Implement a new totally dynamic (up to MAXPHYS) buffer kva allocation
scheme. Additionally, add the capability for checking for unexpected
kernel page faults. The maximum amount of kva space for buffers hasn't
been decreased from where it is, but it will now be possible to do so.
This scheme manages the kva space similar to the buffers themselves. If
there isn't enough kva space because of usage or fragementation, buffers
will be reclaimed until a buffer allocation is successful. This scheme
should be very resistant to fragmentation problems until/if the LFS code
is fixed and uses the bogus buffer locking scheme -- but a 'fixed' LFS
is not likely to use such a scheme.
Now there should be NO problem allocating buffers up to MAXPHYS.
Diffstat (limited to 'sys/vm/vm_pager.c')
-rw-r--r-- | sys/vm/vm_pager.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index b8db9ac..de81090 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_pager.c,v 1.23 1996/05/18 03:38:05 dyson Exp $ + * $Id: vm_pager.c,v 1.24 1996/09/08 20:44:49 dyson Exp $ */ /* @@ -278,6 +278,22 @@ pager_cache(object, should_cache) } /* + * initialize a physical buffer + */ + +static void +initpbuf(struct buf *bp) { + bzero(bp, sizeof *bp); + bp->b_rcred = NOCRED; + bp->b_wcred = NOCRED; + bp->b_qindex = QUEUE_NONE; + bp->b_data = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva; + bp->b_kvabase = bp->b_data; + bp->b_kvasize = MAXPHYS; + bp->b_vnbufs.le_next = NOLIST; +} + +/* * allocate a physical buffer */ struct buf * @@ -295,12 +311,7 @@ getpbuf() TAILQ_REMOVE(&bswlist, bp, b_freelist); splx(s); - bzero(bp, sizeof *bp); - bp->b_rcred = NOCRED; - bp->b_wcred = NOCRED; - bp->b_qindex = QUEUE_NONE; - bp->b_data = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva; - bp->b_vnbufs.le_next = NOLIST; + initpbuf(bp); return bp; } @@ -321,12 +332,8 @@ trypbuf() TAILQ_REMOVE(&bswlist, bp, b_freelist); splx(s); - bzero(bp, sizeof *bp); - bp->b_rcred = NOCRED; - bp->b_wcred = NOCRED; - bp->b_qindex = QUEUE_NONE; - bp->b_data = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva; - bp->b_vnbufs.le_next = NOLIST; + initpbuf(bp); + return bp; } |