- 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)
This commit is contained in:
parent
e8192c8975
commit
255c1caae3
@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/socketvar.h>
|
#include <sys/socketvar.h>
|
||||||
#include <sys/sf_buf.h>
|
#include <sys/sf_buf.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#include <sys/sysent.h>
|
#include <sys/sysent.h>
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#include <machine/cpu.h>
|
#include <machine/cpu.h>
|
||||||
@ -80,16 +81,27 @@ __FBSDID("$FreeBSD$");
|
|||||||
CTASSERT(sizeof(struct switchframe) == 24);
|
CTASSERT(sizeof(struct switchframe) == 24);
|
||||||
CTASSERT(sizeof(struct trapframe) == 80);
|
CTASSERT(sizeof(struct trapframe) == 80);
|
||||||
|
|
||||||
|
#ifndef ARM_USE_SMALL_ALLOC
|
||||||
|
|
||||||
#ifndef NSFBUFS
|
#ifndef NSFBUFS
|
||||||
#define NSFBUFS (512 + maxusers * 16)
|
#define NSFBUFS (512 + maxusers * 16)
|
||||||
#endif
|
#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);
|
static void sf_buf_init(void *arg);
|
||||||
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
||||||
|
|
||||||
LIST_HEAD(sf_head, sf_buf);
|
LIST_HEAD(sf_head, sf_buf);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A hash table of active sendfile(2) buffers
|
* 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
|
* A lock used to synchronize access to the hash table and free list
|
||||||
*/
|
*/
|
||||||
static struct mtx sf_buf_lock;
|
static struct mtx sf_buf_lock;
|
||||||
#endif
|
#endif /* !ARM_USE_SMALL_ALLOC */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finish a fork operation, with process p2 nearly set up.
|
* Finish a fork operation, with process p2 nearly set up.
|
||||||
|
@ -117,6 +117,18 @@ static void cpu_reset_proxy(void);
|
|||||||
static u_int cpu_reset_proxyid;
|
static u_int cpu_reset_proxyid;
|
||||||
static volatile u_int cpu_reset_proxy_active;
|
static volatile u_int cpu_reset_proxy_active;
|
||||||
#endif
|
#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);
|
static void sf_buf_init(void *arg);
|
||||||
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
||||||
|
|
||||||
|
@ -123,19 +123,11 @@ counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)];
|
|||||||
/*
|
/*
|
||||||
* sendfile(2)-related variables and associated sysctls
|
* sendfile(2)-related variables and associated sysctls
|
||||||
*/
|
*/
|
||||||
int nsfbufs;
|
static SYSCTL_NODE(_kern_ipc, OID_AUTO, sendfile, CTLFLAG_RW, 0,
|
||||||
int nsfbufspeak;
|
"sendfile(2) tunables");
|
||||||
int nsfbufsused;
|
|
||||||
static int sfreadahead = 1;
|
static int sfreadahead = 1;
|
||||||
|
SYSCTL_INT(_kern_ipc_sendfile, OID_AUTO, readahead, CTLFLAG_RW,
|
||||||
SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0,
|
&sfreadahead, 0, "Number of sendfile(2) read-ahead MAXBSIZE blocks");
|
||||||
"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");
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -80,10 +80,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/sf_buf.h>
|
#include <sys/sf_buf.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NSFBUFS
|
|
||||||
#define NSFBUFS (512 + maxusers * 16)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Duplicated from asm.h */
|
/* Duplicated from asm.h */
|
||||||
#if defined(__mips_o32)
|
#if defined(__mips_o32)
|
||||||
#define SZREG 4
|
#define SZREG 4
|
||||||
@ -97,6 +93,22 @@ __FBSDID("$FreeBSD$");
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __mips_n64
|
#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);
|
static void sf_buf_init(void *arg);
|
||||||
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
||||||
|
|
||||||
@ -110,7 +122,7 @@ static struct {
|
|||||||
} sf_freelist;
|
} sf_freelist;
|
||||||
|
|
||||||
static u_int sf_buf_alloc_want;
|
static u_int sf_buf_alloc_want;
|
||||||
#endif
|
#endif /* !__mips_n64 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finish a fork operation, with process p2 nearly set up.
|
* Finish a fork operation, with process p2 nearly set up.
|
||||||
|
@ -111,6 +111,17 @@
|
|||||||
#define NSFBUFS (512 + maxusers * 16)
|
#define NSFBUFS (512 + maxusers * 16)
|
||||||
#endif
|
#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);
|
static void sf_buf_init(void *arg);
|
||||||
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
||||||
|
|
||||||
|
@ -137,6 +137,17 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define NSFBUFS (512 + maxusers * 16)
|
#define NSFBUFS (512 + maxusers * 16)
|
||||||
#endif
|
#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);
|
static void sf_buf_init(void *arg);
|
||||||
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
||||||
|
|
||||||
|
@ -88,6 +88,17 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define NSFBUFS (512 + maxusers * 16)
|
#define NSFBUFS (512 + maxusers * 16)
|
||||||
#endif
|
#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);
|
static void sf_buf_init(void *arg);
|
||||||
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
|
||||||
|
|
||||||
|
@ -42,10 +42,6 @@
|
|||||||
|
|
||||||
struct vm_page;
|
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 */
|
struct sfstat { /* sendfile statistics */
|
||||||
uint64_t sf_iocnt; /* times sendfile had to do disk I/O */
|
uint64_t sf_iocnt; /* times sendfile had to do disk I/O */
|
||||||
uint64_t sf_allocfail; /* times sfbuf allocation failed */
|
uint64_t sf_allocfail; /* times sfbuf allocation failed */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user