Reduce contention on the vnode interlock by not acquiring the BO_LOCK
around the check for the BV_BKGRDINPROG in the brelse() and bqrelse(). See the comment for the explanation why it is safe. Tested by: pho Submitted by: jeff
This commit is contained in:
parent
0e2c6b177f
commit
e7ffdf423a
@ -1203,15 +1203,14 @@ brelse(struct buf *bp)
|
|||||||
bp->b_flags &= ~B_RELBUF;
|
bp->b_flags &= ~B_RELBUF;
|
||||||
else if (vm_page_count_severe()) {
|
else if (vm_page_count_severe()) {
|
||||||
/*
|
/*
|
||||||
* XXX This lock may not be necessary since BKGRDINPROG
|
* The locking of the BO_LOCK is not necessary since
|
||||||
* cannot be set while we hold the buf lock, it can only be
|
* BKGRDINPROG cannot be set while we hold the buf
|
||||||
* cleared if it is already pending.
|
* lock, it can only be cleared if it is already
|
||||||
|
* pending.
|
||||||
*/
|
*/
|
||||||
if (bp->b_vp) {
|
if (bp->b_vp) {
|
||||||
BO_LOCK(bp->b_bufobj);
|
|
||||||
if (!(bp->b_vflags & BV_BKGRDINPROG))
|
if (!(bp->b_vflags & BV_BKGRDINPROG))
|
||||||
bp->b_flags |= B_RELBUF;
|
bp->b_flags |= B_RELBUF;
|
||||||
BO_UNLOCK(bp->b_bufobj);
|
|
||||||
} else
|
} else
|
||||||
bp->b_flags |= B_RELBUF;
|
bp->b_flags |= B_RELBUF;
|
||||||
}
|
}
|
||||||
@ -1465,13 +1464,13 @@ bqrelse(struct buf *bp)
|
|||||||
TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist);
|
TAILQ_INSERT_TAIL(&bufqueues[bp->b_qindex], bp, b_freelist);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* XXX This lock may not be necessary since BKGRDINPROG
|
* The locking of the BO_LOCK for checking of the
|
||||||
* cannot be set while we hold the buf lock, it can only be
|
* BV_BKGRDINPROG is not necessary since the
|
||||||
* cleared if it is already pending.
|
* BV_BKGRDINPROG cannot be set while we hold the buf
|
||||||
|
* lock, it can only be cleared if it is already
|
||||||
|
* pending.
|
||||||
*/
|
*/
|
||||||
BO_LOCK(bp->b_bufobj);
|
if (!vm_page_count_severe() || (bp->b_vflags & BV_BKGRDINPROG)) {
|
||||||
if (!vm_page_count_severe() || bp->b_vflags & BV_BKGRDINPROG) {
|
|
||||||
BO_UNLOCK(bp->b_bufobj);
|
|
||||||
bp->b_qindex = QUEUE_CLEAN;
|
bp->b_qindex = QUEUE_CLEAN;
|
||||||
TAILQ_INSERT_TAIL(&bufqueues[QUEUE_CLEAN], bp,
|
TAILQ_INSERT_TAIL(&bufqueues[QUEUE_CLEAN], bp,
|
||||||
b_freelist);
|
b_freelist);
|
||||||
@ -1481,7 +1480,6 @@ bqrelse(struct buf *bp)
|
|||||||
* the buffer (most importantly: the wired pages
|
* the buffer (most importantly: the wired pages
|
||||||
* making up its backing store) *now*.
|
* making up its backing store) *now*.
|
||||||
*/
|
*/
|
||||||
BO_UNLOCK(bp->b_bufobj);
|
|
||||||
mtx_unlock(&bqlock);
|
mtx_unlock(&bqlock);
|
||||||
brelse(bp);
|
brelse(bp);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user