1/*-
2 * Copyright (c) 1980, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
--- 21 unchanged lines hidden (view full) ---
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)param.c 8.3 (Berkeley) 8/20/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/subr_param.c 245575 2013-01-17 21:28:31Z andre $");
39
40#include "opt_param.h"
41#include "opt_msgbuf.h"
42#include "opt_maxusers.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/kernel.h>
--- 41 unchanged lines hidden (view full) ---
88int maxprocperuid; /* max # of procs per user */
89int maxfiles; /* sys. wide open files limit */
90int maxfilesperproc; /* per-proc open files limit */
91int msgbufsize; /* size of kernel message buffer */
92int ncallout; /* maximum # of timer events */
93int nbuf;
94int ngroups_max; /* max # groups per process */
95int nswbuf;
96pid_t pid_max = PID_MAX;
97long maxswzone; /* max swmeta KVA storage */
98long maxbcache; /* max buffer cache KVA storage */
99long maxpipekva; /* Limit on pipe KVA */
100int vm_guest; /* Running as virtual machine guest? */
101u_long maxtsiz; /* max text size */
102u_long dfldsiz; /* initial data size limit */
103u_long maxdsiz; /* max data size */
--- 164 unchanged lines hidden (view full) ---
268}
269
270/*
271 * Boot time overrides that are scaled against main memory
272 */
273void
274init_param2(long physpages)
275{
276
277 /* Base parameters */
278 maxusers = MAXUSERS;
279 TUNABLE_INT_FETCH("kern.maxusers", &maxusers);
280 if (maxusers == 0) {
281 maxusers = physpages / (2 * 1024 * 1024 / PAGE_SIZE);
282 if (maxusers < 32)
283 maxusers = 32;
--- 43 unchanged lines hidden (view full) ---
327 *
328 * Clip callout to result of previous function of maxusers maximum
329 * 384. This is still huge, but acceptable.
330 */
331 ncallout = imin(16 + maxproc + maxfiles, 18508);
332 TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
333
334 /*
335 * The default for maxpipekva is min(1/64 of the kernel address space,
336 * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details.
337 */
338 maxpipekva = (physpages / 64) * PAGE_SIZE;
339 TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
340 if (maxpipekva < 512 * 1024)
341 maxpipekva = 512 * 1024;
342 if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64)
--- 13 unchanged lines hidden ---
2 * Copyright (c) 1980, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
--- 21 unchanged lines hidden (view full) ---
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)param.c 8.3 (Berkeley) 8/20/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/subr_param.c 245575 2013-01-17 21:28:31Z andre $");
39
40#include "opt_param.h"
41#include "opt_msgbuf.h"
42#include "opt_maxusers.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/kernel.h>
--- 41 unchanged lines hidden (view full) ---
88int maxprocperuid; /* max # of procs per user */
89int maxfiles; /* sys. wide open files limit */
90int maxfilesperproc; /* per-proc open files limit */
91int msgbufsize; /* size of kernel message buffer */
92int ncallout; /* maximum # of timer events */
93int nbuf;
94int ngroups_max; /* max # groups per process */
95int nswbuf;
96pid_t pid_max = PID_MAX;
97long maxswzone; /* max swmeta KVA storage */
98long maxbcache; /* max buffer cache KVA storage */
99long maxpipekva; /* Limit on pipe KVA */
100int vm_guest; /* Running as virtual machine guest? */
101u_long maxtsiz; /* max text size */
102u_long dfldsiz; /* initial data size limit */
103u_long maxdsiz; /* max data size */
--- 164 unchanged lines hidden (view full) ---
268}
269
270/*
271 * Boot time overrides that are scaled against main memory
272 */
273void
274init_param2(long physpages)
275{
276
277 /* Base parameters */
278 maxusers = MAXUSERS;
279 TUNABLE_INT_FETCH("kern.maxusers", &maxusers);
280 if (maxusers == 0) {
281 maxusers = physpages / (2 * 1024 * 1024 / PAGE_SIZE);
282 if (maxusers < 32)
283 maxusers = 32;
--- 43 unchanged lines hidden (view full) ---
327 *
328 * Clip callout to result of previous function of maxusers maximum
329 * 384. This is still huge, but acceptable.
330 */
331 ncallout = imin(16 + maxproc + maxfiles, 18508);
332 TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
333
334 /*
335 * The default for maxpipekva is min(1/64 of the kernel address space,
336 * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details.
337 */
338 maxpipekva = (physpages / 64) * PAGE_SIZE;
339 TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
340 if (maxpipekva < 512 * 1024)
341 maxpipekva = 512 * 1024;
342 if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64)
--- 13 unchanged lines hidden ---