summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2006-02-02 21:37:39 +0000
committertegge <tegge@FreeBSD.org>2006-02-02 21:37:39 +0000
commit78439a3a9037bde7a2bc1f43e1ffb8ee38bc1892 (patch)
treefcca12785209540839490f6caa949dae7a51e74f /sys/kern/vfs_bio.c
parente92441a62f29aaeab7aea6b98a836237046cf0c6 (diff)
downloadFreeBSD-src-78439a3a9037bde7a2bc1f43e1ffb8ee38bc1892.zip
FreeBSD-src-78439a3a9037bde7a2bc1f43e1ffb8ee38bc1892.tar.gz
For low memory situations, non-VMIO buffers didnt't release pages back to
the system when brelse() was called with B_RELBUF set on the buffer. This could be a problem when the system was low on memory, had many buffers on QUEUE_EMPTYKVA and started to traverse directories. For each getnewbuf(), pages were allocated from the system, driving the free reserve downwards. For each brelse(), the system put the buffer on QUEUE_CLEAN, with B_INVAL set. This commit changes the semantics of B_RELBUF to also free pages from non-VMIO buffers. Reviewed by: alc
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 8b3abc6..e3780e3 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1312,6 +1312,11 @@ brelse(struct buf *bp)
vfs_vmio_release(bp);
}
+ } else if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0) {
+ if (bp->b_bufsize != 0)
+ allocbuf(bp, 0);
+ if (bp->b_vp != NULL)
+ brelvp(bp);
}
if (BUF_REFCNT(bp) > 1) {
OpenPOWER on IntegriCloud