Count and export the number of prefaulting happen.

MFC after:	 1 month
This commit is contained in:
Konstantin Belousov 2012-06-03 16:06:56 +00:00
parent b82bd838f6
commit bb2f52a61d

View File

@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/filio.h>
#include <sys/resourcevar.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/ttycom.h>
#include <sys/conf.h>
#include <sys/syslog.h>
@ -696,6 +697,9 @@ vn_write(fp, uio, active_cred, flags, td)
}
static const int io_hold_cnt = 16;
static unsigned long vn_io_faults_cnt;
SYSCTL_LONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD,
&vn_io_faults_cnt, 0, "Count of vn_io_fault lock avoidance triggers");
/*
* The vn_io_fault() is a wrapper around vn_read() and vn_write() to
@ -793,6 +797,7 @@ vn_io_fault(struct file *fp, struct uio *uio, struct ucred *active_cred,
if (error != EFAULT)
goto out;
atomic_add_long(&vn_io_faults_cnt, 1);
uio_clone->uio_segflg = UIO_NOCOPY;
uiomove(NULL, resid - uio->uio_resid, uio_clone);
uio_clone->uio_segflg = uio->uio_segflg;