From owner-svn-src-all@FreeBSD.ORG Sun Sep 22 13:36:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 99788933; Sun, 22 Sep 2013 13:36:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 862712F74; Sun, 22 Sep 2013 13:36:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8MDas5a035216; Sun, 22 Sep 2013 13:36:54 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8MDaqYa035192; Sun, 22 Sep 2013 13:36:52 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201309221336.r8MDaqYa035192@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 22 Sep 2013 13:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255786 - in head/sys: arm/arm i386/i386 kern mips/mips powerpc/aim powerpc/booke sparc64/sparc64 sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2013 13:36:54 -0000 Author: glebius Date: Sun Sep 22 13:36:52 2013 New Revision: 255786 URL: http://svnweb.freebsd.org/changeset/base/255786 Log: - Create kern.ipc.sendfile namespace, and put the new "readhead" OID there as "kern.ipc.sendfile.readahead". - Push all nsfbuf related tunables into MD code. Don't move them to new namespace in favor of POLA. Reviewed by: scottl Approved by: re (gjb) Modified: head/sys/arm/arm/vm_machdep.c head/sys/i386/i386/vm_machdep.c head/sys/kern/uipc_syscalls.c head/sys/mips/mips/vm_machdep.c head/sys/powerpc/aim/vm_machdep.c head/sys/powerpc/booke/vm_machdep.c head/sys/sparc64/sparc64/vm_machdep.c head/sys/sys/sf_buf.h Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/arm/arm/vm_machdep.c Sun Sep 22 13:36:52 2013 (r255786) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -80,16 +81,27 @@ __FBSDID("$FreeBSD$"); CTASSERT(sizeof(struct switchframe) == 24); CTASSERT(sizeof(struct trapframe) == 80); +#ifndef ARM_USE_SMALL_ALLOC + #ifndef NSFBUFS #define NSFBUFS (512 + maxusers * 16) #endif -#ifndef ARM_USE_SMALL_ALLOC +static int nsfbufs; +static int nsfbufspeak; +static int nsfbufsused; + +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, + "Maximum number of sendfile(2) sf_bufs available"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, + "Number of sendfile(2) sf_bufs at peak usage"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, + "Number of sendfile(2) sf_bufs in use"); + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); LIST_HEAD(sf_head, sf_buf); - /* * A hash table of active sendfile(2) buffers @@ -106,7 +118,7 @@ static u_int sf_buf_alloc_want; * A lock used to synchronize access to the hash table and free list */ static struct mtx sf_buf_lock; -#endif +#endif /* !ARM_USE_SMALL_ALLOC */ /* * Finish a fork operation, with process p2 nearly set up. Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/i386/i386/vm_machdep.c Sun Sep 22 13:36:52 2013 (r255786) @@ -117,6 +117,18 @@ static void cpu_reset_proxy(void); static u_int cpu_reset_proxyid; static volatile u_int cpu_reset_proxy_active; #endif + +static int nsfbufs; +static int nsfbufspeak; +static int nsfbufsused; + +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, + "Maximum number of sendfile(2) sf_bufs available"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, + "Number of sendfile(2) sf_bufs at peak usage"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, + "Number of sendfile(2) sf_bufs in use"); + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/kern/uipc_syscalls.c Sun Sep 22 13:36:52 2013 (r255786) @@ -123,19 +123,11 @@ counter_u64_t sfstat[sizeof(struct sfsta /* * sendfile(2)-related variables and associated sysctls */ -int nsfbufs; -int nsfbufspeak; -int nsfbufsused; +static SYSCTL_NODE(_kern_ipc, OID_AUTO, sendfile, CTLFLAG_RW, 0, + "sendfile(2) tunables"); static int sfreadahead = 1; - -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, - "Maximum number of sendfile(2) sf_bufs available"); -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, - "Number of sendfile(2) sf_bufs at peak usage"); -SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, - "Number of sendfile(2) sf_bufs in use"); -SYSCTL_INT(_kern_ipc, OID_AUTO, sfreadahead, CTLFLAG_RW, &sfreadahead, 0, - "Number of sendfile(2) read-ahead MAXBSIZE blocks"); +SYSCTL_INT(_kern_ipc_sendfile, OID_AUTO, readahead, CTLFLAG_RW, + &sfreadahead, 0, "Number of sendfile(2) read-ahead MAXBSIZE blocks"); static void Modified: head/sys/mips/mips/vm_machdep.c ============================================================================== --- head/sys/mips/mips/vm_machdep.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/mips/mips/vm_machdep.c Sun Sep 22 13:36:52 2013 (r255786) @@ -80,10 +80,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#ifndef NSFBUFS -#define NSFBUFS (512 + maxusers * 16) -#endif - /* Duplicated from asm.h */ #if defined(__mips_o32) #define SZREG 4 @@ -97,6 +93,22 @@ __FBSDID("$FreeBSD$"); #endif #ifndef __mips_n64 + +#ifndef NSFBUFS +#define NSFBUFS (512 + maxusers * 16) +#endif + +static int nsfbufs; +static int nsfbufspeak; +static int nsfbufsused; + +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, + "Maximum number of sendfile(2) sf_bufs available"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, + "Number of sendfile(2) sf_bufs at peak usage"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, + "Number of sendfile(2) sf_bufs in use"); + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); @@ -110,7 +122,7 @@ static struct { } sf_freelist; static u_int sf_buf_alloc_want; -#endif +#endif /* !__mips_n64 */ /* * Finish a fork operation, with process p2 nearly set up. Modified: head/sys/powerpc/aim/vm_machdep.c ============================================================================== --- head/sys/powerpc/aim/vm_machdep.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/powerpc/aim/vm_machdep.c Sun Sep 22 13:36:52 2013 (r255786) @@ -111,6 +111,17 @@ #define NSFBUFS (512 + maxusers * 16) #endif +static int nsfbufs; +static int nsfbufspeak; +static int nsfbufsused; + +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, + "Maximum number of sendfile(2) sf_bufs available"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, + "Number of sendfile(2) sf_bufs at peak usage"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, + "Number of sendfile(2) sf_bufs in use"); + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); Modified: head/sys/powerpc/booke/vm_machdep.c ============================================================================== --- head/sys/powerpc/booke/vm_machdep.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/powerpc/booke/vm_machdep.c Sun Sep 22 13:36:52 2013 (r255786) @@ -137,6 +137,17 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif +static int nsfbufs; +static int nsfbufspeak; +static int nsfbufsused; + +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, + "Maximum number of sendfile(2) sf_bufs available"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, + "Number of sendfile(2) sf_bufs at peak usage"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, + "Number of sendfile(2) sf_bufs in use"); + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/sparc64/sparc64/vm_machdep.c Sun Sep 22 13:36:52 2013 (r255786) @@ -88,6 +88,17 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif +static int nsfbufs; +static int nsfbufspeak; +static int nsfbufsused; + +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0, + "Maximum number of sendfile(2) sf_bufs available"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0, + "Number of sendfile(2) sf_bufs at peak usage"); +SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0, + "Number of sendfile(2) sf_bufs in use"); + static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL); Modified: head/sys/sys/sf_buf.h ============================================================================== --- head/sys/sys/sf_buf.h Sun Sep 22 10:41:01 2013 (r255785) +++ head/sys/sys/sf_buf.h Sun Sep 22 13:36:52 2013 (r255786) @@ -42,10 +42,6 @@ struct vm_page; -extern int nsfbufs; /* Number of sendfile(2) bufs alloced */ -extern int nsfbufspeak; /* Peak of nsfbufsused */ -extern int nsfbufsused; /* Number of sendfile(2) bufs in use */ - struct sfstat { /* sendfile statistics */ uint64_t sf_iocnt; /* times sendfile had to do disk I/O */ uint64_t sf_allocfail; /* times sfbuf allocation failed */