diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index 1d7484b83c90..da95586a238f 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -415,6 +415,7 @@ sf_buf_alloc(struct vm_page *m) mtx_lock(&sf_freelist.sf_lock); while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_freelist, &sf_freelist.sf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index d7c2c68800aa..be625ce0e7fd 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -460,6 +460,7 @@ sf_buf_alloc(struct vm_page *m) mtx_lock(&sf_freelist.sf_lock); while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_freelist, &sf_freelist.sf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index eebb04e18adf..998780c7fd76 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -621,6 +621,7 @@ sf_buf_alloc(struct vm_page *m) } while ((sf = TAILQ_FIRST(&sf_buf_freelist)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_buf_freelist, &sf_buf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/ia64/ia64/vm_machdep.c b/sys/ia64/ia64/vm_machdep.c index 10c6a619c054..0b72deec7b0b 100644 --- a/sys/ia64/ia64/vm_machdep.c +++ b/sys/ia64/ia64/vm_machdep.c @@ -354,6 +354,7 @@ sf_buf_alloc(struct vm_page *m) mtx_lock(&sf_freelist.sf_lock); while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_freelist, &sf_freelist.sf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 4c59ae8bbc28..b5c500a15558 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1866,6 +1866,7 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) sbunlock(&so->so_snd); goto done; } + mbstat.sf_iocnt++; } else VM_OBJECT_UNLOCK(obj); vm_page_unlock_queues(); @@ -1875,6 +1876,7 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) * but this wait can be interrupted. */ if ((sf = sf_buf_alloc(pg)) == NULL) { + mbstat.sf_allocfail++; vm_page_lock_queues(); vm_page_unwire(pg, 0); if (pg->wire_count == 0 && pg->object == NULL) diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index 5fd9c656c55a..1d582f3bd3a9 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -269,6 +269,7 @@ sf_buf_alloc(struct vm_page *m) mtx_lock(&sf_freelist.sf_lock); while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_freelist, &sf_freelist.sf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index 5fd9c656c55a..1d582f3bd3a9 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -269,6 +269,7 @@ sf_buf_alloc(struct vm_page *m) mtx_lock(&sf_freelist.sf_lock); while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_freelist, &sf_freelist.sf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c index 51a232bc9e8c..2a780749e4e4 100644 --- a/sys/sparc64/sparc64/vm_machdep.c +++ b/sys/sparc64/sparc64/vm_machdep.c @@ -396,6 +396,7 @@ sf_buf_alloc(struct vm_page *m) mtx_lock(&sf_freelist.sf_lock); while ((sf = SLIST_FIRST(&sf_freelist.sf_head)) == NULL) { sf_buf_alloc_want++; + mbstat.sf_allocwait++; error = msleep(&sf_freelist, &sf_freelist.sf_lock, PVM|PCATCH, "sfbufa", 0); sf_buf_alloc_want--; diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index eff28cadcd14..d7f61ce85506 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -261,6 +261,10 @@ struct mbstat { u_int m_clperbuck; /* number of clusters per "bucket" */ /* Number of mbtypes (gives # elems in mbpstat's mb_mbtypes[] array: */ short m_numtypes; + /* XXX: Sendfile stats should eventually move to their own struct */ + u_long sf_iocnt; /* times sendfile had to do disk I/O */ + u_long sf_allocfail; /* times sfbuf allocation failed */ + u_long sf_allocwait; /* times sfbuf allocation had to wait */ }; /*