Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/subr_param.c
Show All 35 Lines | |||||
* @(#)param.c 8.3 (Berkeley) 8/20/94 | * @(#)param.c 8.3 (Berkeley) 8/20/94 | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_param.h" | #include "opt_param.h" | ||||
#include "opt_msgbuf.h" | #include "opt_msgbuf.h" | ||||
#include "opt_maxphys.h" | |||||
#include "opt_maxusers.h" | #include "opt_maxusers.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/buf.h> | #include <sys/buf.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/msgbuf.h> | #include <sys/msgbuf.h> | ||||
Show All 38 Lines | |||||
struct bintime tick_bt; /* bintime per tick (1s / hz) */ | struct bintime tick_bt; /* bintime per tick (1s / hz) */ | ||||
sbintime_t tick_sbt; | sbintime_t tick_sbt; | ||||
int maxusers; /* base tunable */ | int maxusers; /* base tunable */ | ||||
int maxproc; /* maximum # of processes */ | int maxproc; /* maximum # of processes */ | ||||
int maxprocperuid; /* max # of procs per user */ | int maxprocperuid; /* max # of procs per user */ | ||||
int maxfiles; /* sys. wide open files limit */ | int maxfiles; /* sys. wide open files limit */ | ||||
int maxfilesperproc; /* per-proc open files limit */ | int maxfilesperproc; /* per-proc open files limit */ | ||||
int msgbufsize; /* size of kernel message buffer */ | int msgbufsize; /* size of kernel message buffer */ | ||||
int nbuf; | int nbuf; /* number of bcache bufs */ | ||||
int bio_transient_maxcnt; | int bio_transient_maxcnt; | ||||
int ngroups_max; /* max # groups per process */ | int ngroups_max; /* max # groups per process */ | ||||
int nswbuf; | int nswbuf; | ||||
pid_t pid_max = PID_MAX; | pid_t pid_max = PID_MAX; | ||||
long maxswzone; /* max swmeta KVA storage */ | u_long maxswzone; /* max swmeta KVA storage */ | ||||
long maxbcache; /* max buffer cache KVA storage */ | u_long maxbcache; /* max buffer cache KVA storage */ | ||||
long maxpipekva; /* Limit on pipe KVA */ | u_long maxpipekva; /* Limit on pipe KVA */ | ||||
u_long maxphys; /* max raw I/O transfer size */ | |||||
int vm_guest = VM_GUEST_NO; /* Running as virtual machine guest? */ | int vm_guest = VM_GUEST_NO; /* Running as virtual machine guest? */ | ||||
u_long maxtsiz; /* max text size */ | u_long maxtsiz; /* max text size */ | ||||
u_long dfldsiz; /* initial data size limit */ | u_long dfldsiz; /* initial data size limit */ | ||||
u_long maxdsiz; /* max data size */ | u_long maxdsiz; /* max data size */ | ||||
u_long dflssiz; /* initial stack size limit */ | u_long dflssiz; /* initial stack size limit */ | ||||
u_long maxssiz; /* max stack size */ | u_long maxssiz; /* max stack size */ | ||||
u_long sgrowsiz; /* amount to grow stack */ | u_long sgrowsiz; /* amount to grow stack */ | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | #endif | ||||
TUNABLE_INT_FETCH("kern.maxfilesperproc", &maxfilesperproc); | TUNABLE_INT_FETCH("kern.maxfilesperproc", &maxfilesperproc); | ||||
/* | /* | ||||
* Cannot be changed after boot. | * Cannot be changed after boot. | ||||
*/ | */ | ||||
nbuf = NBUF; | nbuf = NBUF; | ||||
TUNABLE_INT_FETCH("kern.nbuf", &nbuf); | TUNABLE_INT_FETCH("kern.nbuf", &nbuf); | ||||
TUNABLE_INT_FETCH("kern.bio_transient_maxcnt", &bio_transient_maxcnt); | TUNABLE_INT_FETCH("kern.bio_transient_maxcnt", &bio_transient_maxcnt); | ||||
maxphys = MAXPHYS; | |||||
TUNABLE_ULONG_FETCH("kern.maxphys", &maxphys); | |||||
if (maxphys == 0) { | |||||
maxphys = MAXPHYS; | |||||
} else if (__bitcountl(maxphys) != 1) { /* power of two */ | |||||
if (flsl(maxphys) == NBBY * sizeof(maxphys)) | |||||
maxphys = MAXPHYS; | |||||
else | |||||
maxphys = 1UL << flsl(maxphys); | |||||
} | |||||
if (maxphys < PAGE_SIZE) | |||||
maxphys = MAXPHYS; | |||||
/* | /* | ||||
* Physical buffers are pre-allocated buffers (struct buf) that | * Physical buffers are pre-allocated buffers (struct buf) that | ||||
* are used as temporary holders for I/O, such as paging I/O. | * are used as temporary holders for I/O, such as paging I/O. | ||||
*/ | */ | ||||
TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf); | TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf); | ||||
/* | /* | ||||
* The default for maxpipekva is min(1/64 of the kernel address space, | * The default for maxpipekva is min(1/64 of the kernel address space, | ||||
* max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. | * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details. | ||||
*/ | */ | ||||
maxpipekva = (physpages / 64) * PAGE_SIZE; | maxpipekva = ptoa(physpages / 64); | ||||
TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); | TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva); | ||||
if (maxpipekva < 512 * 1024) | if (maxpipekva < 512 * 1024) | ||||
maxpipekva = 512 * 1024; | maxpipekva = 512 * 1024; | ||||
if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) | if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64) | ||||
maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / | maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / | ||||
64; | 64; | ||||
} | } | ||||
/* | /* | ||||
* Sysctl stringifying handler for kern.vm_guest. | * Sysctl stringifying handler for kern.vm_guest. | ||||
*/ | */ | ||||
static int | static int | ||||
sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS) | sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
return (SYSCTL_OUT_STR(req, vm_guest_sysctl_names[vm_guest])); | return (SYSCTL_OUT_STR(req, vm_guest_sysctl_names[vm_guest])); | ||||
} | } |