Batch v_wire_count decrements in vm_hold_free_pages().

Atomic updates to v_wire_count are a significant source of contention, so
combine multiple updates into one in this easy case. Also remove an old
printf that gets executed if the page is shared-busied, which is a case
that will lead to a panic anyway.

Reviewed by:	alc, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11791
This commit is contained in:
Mark Johnston 2017-07-31 18:48:58 +00:00
parent 3a122598ce
commit 6c7ebc242b

View File

@ -4532,13 +4532,10 @@ vm_hold_free_pages(struct buf *bp, int newbsize)
for (index = newnpages; index < bp->b_npages; index++) {
p = bp->b_pages[index];
bp->b_pages[index] = NULL;
if (vm_page_sbusied(p))
printf("vm_hold_free_pages: blkno: %jd, lblkno: %jd\n",
(intmax_t)bp->b_blkno, (intmax_t)bp->b_lblkno);
p->wire_count--;
vm_page_free(p);
atomic_subtract_int(&vm_cnt.v_wire_count, 1);
}
atomic_subtract_int(&vm_cnt.v_wire_count, bp->b_npages - newnpages);
bp->b_npages = newnpages;
}