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
This commit is contained in:
tegge 2006-02-02 21:37:39 +00:00
parent e92441a62f
commit 78439a3a90

View File

@ -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) {