subr_param.c (9b4fcf851a73554063d4a2de9a4f10cd23a0a4f6) subr_param.c (e9a3f7852d754fe0af27fae7e7215ca9db8d328f)
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.

--- 34 unchanged lines hidden (view full) ---

43
44#include <sys/limits.h>
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/sysctl.h>
49#include <sys/msgbuf.h>
50
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.

--- 34 unchanged lines hidden (view full) ---

43
44#include <sys/limits.h>
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/sysctl.h>
49#include <sys/msgbuf.h>
50
51#include <vm/vm.h>
51#include <vm/vm_param.h>
52#include <vm/vm_param.h>
53#include <vm/pmap.h>
52
53/*
54 * System parameter formulae.
55 */
56
57#ifndef HZ
58# if defined(__mips__) || defined(__arm__)
59# define HZ 100

--- 228 unchanged lines hidden (view full) ---

288 /*
289 * Cannot be changed after boot.
290 */
291 nbuf = NBUF;
292 TUNABLE_INT_FETCH("kern.nbuf", &nbuf);
293
294 ncallout = 16 + maxproc + maxfiles;
295 TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
54
55/*
56 * System parameter formulae.
57 */
58
59#ifndef HZ
60# if defined(__mips__) || defined(__arm__)
61# define HZ 100

--- 228 unchanged lines hidden (view full) ---

290 /*
291 * Cannot be changed after boot.
292 */
293 nbuf = NBUF;
294 TUNABLE_INT_FETCH("kern.nbuf", &nbuf);
295
296 ncallout = 16 + maxproc + maxfiles;
297 TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
296}
297
298
298/*
299 * Boot time overrides that are scaled against the kmem map
300 */
301void
302init_param3(long kmempages)
303{
304
305 /*
299 /*
306 * The default for maxpipekva is max(5% of the kmem map, 512KB).
307 * See sys_pipe.c for more details.
300 * The default for maxpipekva is min(1/64 of the kernel address space,
301 * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details.
308 */
302 */
309 maxpipekva = (kmempages / 20) * PAGE_SIZE;
303 maxpipekva = (physpages / 64) * PAGE_SIZE;
310 if (maxpipekva < 512 * 1024)
311 maxpipekva = 512 * 1024;
304 if (maxpipekva < 512 * 1024)
305 maxpipekva = 512 * 1024;
306 if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64)
307 maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) /
308 64;
312 TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
313}
314
315/*
316 * Sysctl stringiying handler for kern.vm_guest.
317 */
318static int
319sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS)
320{
321 return (SYSCTL_OUT(req, vm_guest_sysctl_names[vm_guest],
322 strlen(vm_guest_sysctl_names[vm_guest])));
323}
309 TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
310}
311
312/*
313 * Sysctl stringiying handler for kern.vm_guest.
314 */
315static int
316sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS)
317{
318 return (SYSCTL_OUT(req, vm_guest_sysctl_names[vm_guest],
319 strlen(vm_guest_sysctl_names[vm_guest])));
320}