From 41c895a8884ab0f6b58abdfd4fded5b83535d626 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Mon, 16 Mar 2015 14:24:47 +0000 Subject: [PATCH] Provide a comment explaining r279688. Suggested by: alc --- sys/vm/vnode_pager.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index f5bee64662f1..ac3bc9976241 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -772,6 +772,14 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int bytecount, bsize = vp->v_mount->mnt_stat.f_iosize; foff = IDX_TO_OFF(m[reqpage]->pindex); + /* + * Synchronous and asynchronous paging operations use different + * free pbuf counters. This is done to avoid asynchronous requests + * to consume all pbufs. + * Allocate the pbuf at the very beginning of the function, so that + * if we are low on certain kind of pbufs don't even proceed to BMAP, + * but sleep. + */ freecnt = iodone != NULL ? &vnode_async_pbuf_freecnt : &vnode_pbuf_freecnt; bp = getpbuf(freecnt);