165475bc8SDavid E. O'Brien /*- 29b50d902SRodney W. Grimes * Copyright (c) 1983, 1988, 1993 3c8e6b689SRobert Watson * The Regents of the University of California. 4c8e6b689SRobert Watson * Copyright (c) 2005 Robert N. M. Watson 5c8e6b689SRobert Watson * All rights reserved. 69b50d902SRodney W. Grimes * 79b50d902SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 89b50d902SRodney W. Grimes * modification, are permitted provided that the following conditions 99b50d902SRodney W. Grimes * are met: 109b50d902SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 119b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 129b50d902SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 139b50d902SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 149b50d902SRodney W. Grimes * documentation and/or other materials provided with the distribution. 159b50d902SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 169b50d902SRodney W. Grimes * must display the following acknowledgement: 179b50d902SRodney W. Grimes * This product includes software developed by the University of 189b50d902SRodney W. Grimes * California, Berkeley and its contributors. 199b50d902SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 209b50d902SRodney W. Grimes * may be used to endorse or promote products derived from this software 219b50d902SRodney W. Grimes * without specific prior written permission. 229b50d902SRodney W. Grimes * 239b50d902SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 249b50d902SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 259b50d902SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 269b50d902SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 279b50d902SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 289b50d902SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 299b50d902SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 309b50d902SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 319b50d902SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 329b50d902SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 339b50d902SRodney W. Grimes * SUCH DAMAGE. 349b50d902SRodney W. Grimes */ 359b50d902SRodney W. Grimes 365d422d6aSPhilippe Charnier #if 0 376cc6f122SPhilippe Charnier #ifndef lint 389b50d902SRodney W. Grimes static char sccsid[] = "@(#)mbuf.c 8.1 (Berkeley) 6/6/93"; 399b50d902SRodney W. Grimes #endif /* not lint */ 406cc6f122SPhilippe Charnier #endif 416cc6f122SPhilippe Charnier 426cc6f122SPhilippe Charnier #include <sys/cdefs.h> 436cc6f122SPhilippe Charnier __FBSDID("$FreeBSD$"); 449b50d902SRodney W. Grimes 459b50d902SRodney W. Grimes #include <sys/param.h> 4613ae2e2dSGarrett Wollman #include <sys/mbuf.h> 479b50d902SRodney W. Grimes #include <sys/protosw.h> 4805d1f5bcSAndrey V. Elsukov #include <sys/sf_buf.h> 499b50d902SRodney W. Grimes #include <sys/socket.h> 50feda1a43SJohn Baldwin #include <sys/socketvar.h> 5113ae2e2dSGarrett Wollman #include <sys/sysctl.h> 529b50d902SRodney W. Grimes 535d422d6aSPhilippe Charnier #include <err.h> 54d4426f28SRobert Watson #include <kvm.h> 55c8e6b689SRobert Watson #include <memstat.h> 567b95a1ebSYaroslav Tykhiy #include <stdint.h> 579b50d902SRodney W. Grimes #include <stdio.h> 58821df508SXin LI #include <stdlib.h> 59821df508SXin LI #include <string.h> 609b50d902SRodney W. Grimes #include "netstat.h" 619b50d902SRodney W. Grimes 629b50d902SRodney W. Grimes /* 63d4426f28SRobert Watson * Print mbuf statistics. 649b50d902SRodney W. Grimes */ 659b50d902SRodney W. Grimes void 66d4426f28SRobert Watson mbpr(void *kvmd, u_long mbaddr) 67c8e6b689SRobert Watson { 68c8e6b689SRobert Watson struct memory_type_list *mtlp; 69c8e6b689SRobert Watson struct memory_type *mtp; 707b95a1ebSYaroslav Tykhiy uintmax_t mbuf_count, mbuf_bytes, mbuf_free, mbuf_failures, mbuf_size; 71504a74faSAlfred Perlstein uintmax_t mbuf_sleeps; 72*d35acb50SGleb Smirnoff uintmax_t cluster_count, cluster_limit, cluster_free; 73504a74faSAlfred Perlstein uintmax_t cluster_failures, cluster_size, cluster_sleeps; 747b95a1ebSYaroslav Tykhiy uintmax_t packet_count, packet_bytes, packet_free, packet_failures; 75504a74faSAlfred Perlstein uintmax_t packet_sleeps; 76*d35acb50SGleb Smirnoff uintmax_t tag_bytes; 77*d35acb50SGleb Smirnoff uintmax_t jumbop_count, jumbop_limit, jumbop_free; 78504a74faSAlfred Perlstein uintmax_t jumbop_failures, jumbop_sleeps, jumbop_size; 79*d35acb50SGleb Smirnoff uintmax_t jumbo9_count, jumbo9_limit, jumbo9_free; 80504a74faSAlfred Perlstein uintmax_t jumbo9_failures, jumbo9_sleeps, jumbo9_size; 81*d35acb50SGleb Smirnoff uintmax_t jumbo16_count, jumbo16_limit, jumbo16_free; 82504a74faSAlfred Perlstein uintmax_t jumbo16_failures, jumbo16_sleeps, jumbo16_size; 837b95a1ebSYaroslav Tykhiy uintmax_t bytes_inuse, bytes_incache, bytes_total; 84c8e6b689SRobert Watson int nsfbufs, nsfbufspeak, nsfbufsused; 8505d1f5bcSAndrey V. Elsukov struct sfstat sfstat; 86c8e6b689SRobert Watson size_t mlen; 87feda1a43SJohn Baldwin int error; 88c8e6b689SRobert Watson 89c8e6b689SRobert Watson mtlp = memstat_mtl_alloc(); 90c8e6b689SRobert Watson if (mtlp == NULL) { 91c8e6b689SRobert Watson warn("memstat_mtl_alloc"); 92c8e6b689SRobert Watson return; 93c8e6b689SRobert Watson } 94c8e6b689SRobert Watson 95c8e6b689SRobert Watson /* 96d4426f28SRobert Watson * Use memstat_*_all() because some mbuf-related memory is in uma(9), 97d4426f28SRobert Watson * and some malloc(9). 98c8e6b689SRobert Watson */ 99d4426f28SRobert Watson if (live) { 100c8e6b689SRobert Watson if (memstat_sysctl_all(mtlp, 0) < 0) { 1014f7ac59bSRobert Watson warnx("memstat_sysctl_all: %s", 1024f7ac59bSRobert Watson memstat_strerror(memstat_mtl_geterror(mtlp))); 103c8e6b689SRobert Watson goto out; 104c8e6b689SRobert Watson } 105d4426f28SRobert Watson } else { 106d4426f28SRobert Watson if (memstat_kvm_all(mtlp, kvmd) < 0) { 107d4426f28SRobert Watson error = memstat_mtl_geterror(mtlp); 108d4426f28SRobert Watson if (error == MEMSTAT_ERROR_KVM) 109d4426f28SRobert Watson warnx("memstat_kvm_all: %s", 110d4426f28SRobert Watson kvm_geterr(kvmd)); 111d4426f28SRobert Watson else 112d4426f28SRobert Watson warnx("memstat_kvm_all: %s", 113d4426f28SRobert Watson memstat_strerror(error)); 114d4426f28SRobert Watson goto out; 115d4426f28SRobert Watson } 116d4426f28SRobert Watson } 117c8e6b689SRobert Watson 118c8e6b689SRobert Watson mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_MEM_NAME); 119c8e6b689SRobert Watson if (mtp == NULL) { 120c8e6b689SRobert Watson warnx("memstat_mtl_find: zone %s not found", MBUF_MEM_NAME); 121c8e6b689SRobert Watson goto out; 122c8e6b689SRobert Watson } 123c8e6b689SRobert Watson mbuf_count = memstat_get_count(mtp); 124c8e6b689SRobert Watson mbuf_bytes = memstat_get_bytes(mtp); 125c8e6b689SRobert Watson mbuf_free = memstat_get_free(mtp); 126c8e6b689SRobert Watson mbuf_failures = memstat_get_failures(mtp); 127504a74faSAlfred Perlstein mbuf_sleeps = memstat_get_sleeps(mtp); 128c8e6b689SRobert Watson mbuf_size = memstat_get_size(mtp); 129c8e6b689SRobert Watson 130c8e6b689SRobert Watson mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_PACKET_MEM_NAME); 131c8e6b689SRobert Watson if (mtp == NULL) { 132c8e6b689SRobert Watson warnx("memstat_mtl_find: zone %s not found", 133c8e6b689SRobert Watson MBUF_PACKET_MEM_NAME); 134c8e6b689SRobert Watson goto out; 135c8e6b689SRobert Watson } 136c8e6b689SRobert Watson packet_count = memstat_get_count(mtp); 137c8e6b689SRobert Watson packet_bytes = memstat_get_bytes(mtp); 138c8e6b689SRobert Watson packet_free = memstat_get_free(mtp); 139504a74faSAlfred Perlstein packet_sleeps = memstat_get_sleeps(mtp); 140c8e6b689SRobert Watson packet_failures = memstat_get_failures(mtp); 141c8e6b689SRobert Watson 142c8e6b689SRobert Watson mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_CLUSTER_MEM_NAME); 143c8e6b689SRobert Watson if (mtp == NULL) { 144c8e6b689SRobert Watson warnx("memstat_mtl_find: zone %s not found", 145c8e6b689SRobert Watson MBUF_CLUSTER_MEM_NAME); 146c8e6b689SRobert Watson goto out; 147c8e6b689SRobert Watson } 148c8e6b689SRobert Watson cluster_count = memstat_get_count(mtp); 149c8e6b689SRobert Watson cluster_limit = memstat_get_countlimit(mtp); 150c8e6b689SRobert Watson cluster_free = memstat_get_free(mtp); 151c8e6b689SRobert Watson cluster_failures = memstat_get_failures(mtp); 152504a74faSAlfred Perlstein cluster_sleeps = memstat_get_sleeps(mtp); 153c8e6b689SRobert Watson cluster_size = memstat_get_size(mtp); 154c8e6b689SRobert Watson 155c8e6b689SRobert Watson mtp = memstat_mtl_find(mtlp, ALLOCATOR_MALLOC, MBUF_TAG_MEM_NAME); 156c8e6b689SRobert Watson if (mtp == NULL) { 157c8e6b689SRobert Watson warnx("memstat_mtl_find: malloc type %s not found", 158c8e6b689SRobert Watson MBUF_TAG_MEM_NAME); 159c8e6b689SRobert Watson goto out; 160c8e6b689SRobert Watson } 161c8e6b689SRobert Watson tag_bytes = memstat_get_bytes(mtp); 162c8e6b689SRobert Watson 1632b22cf9cSAndre Oppermann mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBOP_MEM_NAME); 1642b22cf9cSAndre Oppermann if (mtp == NULL) { 1652b22cf9cSAndre Oppermann warnx("memstat_mtl_find: zone %s not found", 1662b22cf9cSAndre Oppermann MBUF_JUMBOP_MEM_NAME); 1672b22cf9cSAndre Oppermann goto out; 1682b22cf9cSAndre Oppermann } 1692b22cf9cSAndre Oppermann jumbop_count = memstat_get_count(mtp); 1702b22cf9cSAndre Oppermann jumbop_limit = memstat_get_countlimit(mtp); 1712b22cf9cSAndre Oppermann jumbop_free = memstat_get_free(mtp); 1722b22cf9cSAndre Oppermann jumbop_failures = memstat_get_failures(mtp); 173504a74faSAlfred Perlstein jumbop_sleeps = memstat_get_sleeps(mtp); 1742b22cf9cSAndre Oppermann jumbop_size = memstat_get_size(mtp); 1752b22cf9cSAndre Oppermann 1762b22cf9cSAndre Oppermann mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO9_MEM_NAME); 1772b22cf9cSAndre Oppermann if (mtp == NULL) { 1782b22cf9cSAndre Oppermann warnx("memstat_mtl_find: zone %s not found", 1792b22cf9cSAndre Oppermann MBUF_JUMBO9_MEM_NAME); 1802b22cf9cSAndre Oppermann goto out; 1812b22cf9cSAndre Oppermann } 1822b22cf9cSAndre Oppermann jumbo9_count = memstat_get_count(mtp); 1832b22cf9cSAndre Oppermann jumbo9_limit = memstat_get_countlimit(mtp); 1842b22cf9cSAndre Oppermann jumbo9_free = memstat_get_free(mtp); 1852b22cf9cSAndre Oppermann jumbo9_failures = memstat_get_failures(mtp); 186504a74faSAlfred Perlstein jumbo9_sleeps = memstat_get_sleeps(mtp); 1872b22cf9cSAndre Oppermann jumbo9_size = memstat_get_size(mtp); 1882b22cf9cSAndre Oppermann 1892b22cf9cSAndre Oppermann mtp = memstat_mtl_find(mtlp, ALLOCATOR_UMA, MBUF_JUMBO16_MEM_NAME); 1902b22cf9cSAndre Oppermann if (mtp == NULL) { 1912b22cf9cSAndre Oppermann warnx("memstat_mtl_find: zone %s not found", 1922b22cf9cSAndre Oppermann MBUF_JUMBO16_MEM_NAME); 1932b22cf9cSAndre Oppermann goto out; 1942b22cf9cSAndre Oppermann } 1952b22cf9cSAndre Oppermann jumbo16_count = memstat_get_count(mtp); 1962b22cf9cSAndre Oppermann jumbo16_limit = memstat_get_countlimit(mtp); 1972b22cf9cSAndre Oppermann jumbo16_free = memstat_get_free(mtp); 1982b22cf9cSAndre Oppermann jumbo16_failures = memstat_get_failures(mtp); 199504a74faSAlfred Perlstein jumbo16_sleeps = memstat_get_sleeps(mtp); 2002b22cf9cSAndre Oppermann jumbo16_size = memstat_get_size(mtp); 2012b22cf9cSAndre Oppermann 2027b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju mbufs in use (current/cache/total)\n", 203c8e6b689SRobert Watson mbuf_count + packet_count, mbuf_free + packet_free, 204c8e6b689SRobert Watson mbuf_count + packet_count + mbuf_free + packet_free); 205c8e6b689SRobert Watson 2067b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju/%ju mbuf clusters in use " 207c8e6b689SRobert Watson "(current/cache/total/max)\n", 208c8e6b689SRobert Watson cluster_count - packet_free, cluster_free + packet_free, 209c8e6b689SRobert Watson cluster_count + cluster_free, cluster_limit); 210c8e6b689SRobert Watson 2117b95a1ebSYaroslav Tykhiy printf("%ju/%ju mbuf+clusters out of packet secondary zone in use " 2121434cbd6SAndre Oppermann "(current/cache)\n", 2131434cbd6SAndre Oppermann packet_count, packet_free); 2141434cbd6SAndre Oppermann 2157b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju/%ju %juk (page size) jumbo clusters in use " 2162b22cf9cSAndre Oppermann "(current/cache/total/max)\n", 2172b22cf9cSAndre Oppermann jumbop_count, jumbop_free, jumbop_count + jumbop_free, 2182b22cf9cSAndre Oppermann jumbop_limit, jumbop_size / 1024); 2192b22cf9cSAndre Oppermann 2207b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju/%ju 9k jumbo clusters in use " 2212b22cf9cSAndre Oppermann "(current/cache/total/max)\n", 2222b22cf9cSAndre Oppermann jumbo9_count, jumbo9_free, jumbo9_count + jumbo9_free, 2232b22cf9cSAndre Oppermann jumbo9_limit); 2242b22cf9cSAndre Oppermann 2257b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju/%ju 16k jumbo clusters in use " 2262b22cf9cSAndre Oppermann "(current/cache/total/max)\n", 2272b22cf9cSAndre Oppermann jumbo16_count, jumbo16_free, jumbo16_count + jumbo16_free, 2282b22cf9cSAndre Oppermann jumbo16_limit); 2292b22cf9cSAndre Oppermann 230c8e6b689SRobert Watson #if 0 2317b95a1ebSYaroslav Tykhiy printf("%ju mbuf tags in use\n", tag_count); 232c8e6b689SRobert Watson #endif 233c8e6b689SRobert Watson 234c8e6b689SRobert Watson /*- 235c8e6b689SRobert Watson * Calculate in-use bytes as: 236c8e6b689SRobert Watson * - straight mbuf memory 237c8e6b689SRobert Watson * - mbuf memory in packets 238c8e6b689SRobert Watson * - the clusters attached to packets 239c8e6b689SRobert Watson * - and the rest of the non-packet-attached clusters. 240c8e6b689SRobert Watson * - m_tag memory 241c8e6b689SRobert Watson * This avoids counting the clusters attached to packets in the cache. 242c8e6b689SRobert Watson * This currently excludes sf_buf space. 243c8e6b689SRobert Watson */ 244c8e6b689SRobert Watson bytes_inuse = 245c8e6b689SRobert Watson mbuf_bytes + /* straight mbuf memory */ 246c8e6b689SRobert Watson packet_bytes + /* mbufs in packets */ 247c8e6b689SRobert Watson (packet_count * cluster_size) + /* clusters in packets */ 248c8e6b689SRobert Watson /* other clusters */ 249c8e6b689SRobert Watson ((cluster_count - packet_count - packet_free) * cluster_size) + 2502b22cf9cSAndre Oppermann tag_bytes + 2512b22cf9cSAndre Oppermann (jumbop_count * jumbop_size) + /* jumbo clusters */ 2522b22cf9cSAndre Oppermann (jumbo9_count * jumbo9_size) + 2532b22cf9cSAndre Oppermann (jumbo16_count * jumbo16_size); 254c8e6b689SRobert Watson 255c8e6b689SRobert Watson /* 256c8e6b689SRobert Watson * Calculate in-cache bytes as: 257c8e6b689SRobert Watson * - cached straught mbufs 258c8e6b689SRobert Watson * - cached packet mbufs 259c8e6b689SRobert Watson * - cached packet clusters 260c8e6b689SRobert Watson * - cached straight clusters 261c8e6b689SRobert Watson * This currently excludes sf_buf space. 262c8e6b689SRobert Watson */ 263c8e6b689SRobert Watson bytes_incache = 264c8e6b689SRobert Watson (mbuf_free * mbuf_size) + /* straight free mbufs */ 265c8e6b689SRobert Watson (packet_free * mbuf_size) + /* mbufs in free packets */ 266c8e6b689SRobert Watson (packet_free * cluster_size) + /* clusters in free packets */ 2672b22cf9cSAndre Oppermann (cluster_free * cluster_size) + /* free clusters */ 2682b22cf9cSAndre Oppermann (jumbop_free * jumbop_size) + /* jumbo clusters */ 2692b22cf9cSAndre Oppermann (jumbo9_free * jumbo9_size) + 2702b22cf9cSAndre Oppermann (jumbo16_free * jumbo16_size); 271c8e6b689SRobert Watson 272c8e6b689SRobert Watson /* 273c8e6b689SRobert Watson * Total is bytes in use + bytes in cache. This doesn't take into 274c8e6b689SRobert Watson * account various other misc data structures, overhead, etc, but 275c8e6b689SRobert Watson * gives the user something useful despite that. 276c8e6b689SRobert Watson */ 277c8e6b689SRobert Watson bytes_total = bytes_inuse + bytes_incache; 278c8e6b689SRobert Watson 2797b95a1ebSYaroslav Tykhiy printf("%juK/%juK/%juK bytes allocated to network " 280c8e6b689SRobert Watson "(current/cache/total)\n", bytes_inuse / 1024, 281c8e6b689SRobert Watson bytes_incache / 1024, bytes_total / 1024); 282c8e6b689SRobert Watson 2837b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju requests for mbufs denied (mbufs/clusters/" 284c8e6b689SRobert Watson "mbuf+clusters)\n", mbuf_failures, cluster_failures, 285c8e6b689SRobert Watson packet_failures); 286504a74faSAlfred Perlstein printf("%ju/%ju/%ju requests for mbufs delayed (mbufs/clusters/" 287504a74faSAlfred Perlstein "mbuf+clusters)\n", mbuf_sleeps, cluster_sleeps, 288504a74faSAlfred Perlstein packet_sleeps); 289c8e6b689SRobert Watson 290504a74faSAlfred Perlstein printf("%ju/%ju/%ju requests for jumbo clusters delayed " 291504a74faSAlfred Perlstein "(%juk/9k/16k)\n", jumbop_sleeps, jumbo9_sleeps, 292504a74faSAlfred Perlstein jumbo16_sleeps, jumbop_size / 1024); 2937b95a1ebSYaroslav Tykhiy printf("%ju/%ju/%ju requests for jumbo clusters denied " 2947b95a1ebSYaroslav Tykhiy "(%juk/9k/16k)\n", jumbop_failures, jumbo9_failures, 2952b22cf9cSAndre Oppermann jumbo16_failures, jumbop_size / 1024); 2962b22cf9cSAndre Oppermann 297d4426f28SRobert Watson if (live) { 298dd8dfa82SRobert Watson mlen = sizeof(nsfbufs); 299dd8dfa82SRobert Watson if (!sysctlbyname("kern.ipc.nsfbufs", &nsfbufs, &mlen, NULL, 300dd8dfa82SRobert Watson 0) && 301dd8dfa82SRobert Watson !sysctlbyname("kern.ipc.nsfbufsused", &nsfbufsused, 302dd8dfa82SRobert Watson &mlen, NULL, 0) && 303dd8dfa82SRobert Watson !sysctlbyname("kern.ipc.nsfbufspeak", &nsfbufspeak, 304dd8dfa82SRobert Watson &mlen, NULL, 0)) 305dd8dfa82SRobert Watson printf("%d/%d/%d sfbufs in use (current/peak/max)\n", 306dd8dfa82SRobert Watson nsfbufsused, nsfbufspeak, nsfbufs); 30705d1f5bcSAndrey V. Elsukov mlen = sizeof(sfstat); 30805d1f5bcSAndrey V. Elsukov if (sysctlbyname("kern.ipc.sfstat", &sfstat, &mlen, NULL, 0)) { 30905d1f5bcSAndrey V. Elsukov warn("kern.ipc.sfstat"); 310d4426f28SRobert Watson goto out; 311d4426f28SRobert Watson } 312d4426f28SRobert Watson } else { 31305d1f5bcSAndrey V. Elsukov if (kread_counters(mbaddr, (char *)&sfstat, sizeof sfstat) != 0) 314d4426f28SRobert Watson goto out; 315d4426f28SRobert Watson } 31605d1f5bcSAndrey V. Elsukov printf("%ju requests for sfbufs denied\n", 31705d1f5bcSAndrey V. Elsukov (uintmax_t)sfstat.sf_allocfail); 31805d1f5bcSAndrey V. Elsukov printf("%ju requests for sfbufs delayed\n", 31905d1f5bcSAndrey V. Elsukov (uintmax_t)sfstat.sf_allocwait); 32005d1f5bcSAndrey V. Elsukov printf("%ju requests for I/O initiated by sendfile\n", 32105d1f5bcSAndrey V. Elsukov (uintmax_t)sfstat.sf_iocnt); 322c8e6b689SRobert Watson out: 323c8e6b689SRobert Watson memstat_mtl_free(mtlp); 324c8e6b689SRobert Watson } 325