17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5843e1988Sjohnlev  * Common Development and Distribution License (the "License").
6843e1988Sjohnlev  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
22b4203d75SMarcel Telka /*	  All Rights Reserved	*/
237c478bd9Sstevel@tonic-gate /*
24843e1988Sjohnlev  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef _SYS_VM_MACHPARAM_H
297c478bd9Sstevel@tonic-gate #define	_SYS_VM_MACHPARAM_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Machine dependent constants for PC.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * USRTEXT is the start of the user text/data space.
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate #define	USRTEXT		USRSTACK
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Virtual memory related constants for UNIX resource control, all in bytes.
467c478bd9Sstevel@tonic-gate  * The default stack size (initial stack size limit) keeps the stack from
477c478bd9Sstevel@tonic-gate  * taking more than 2 page directory entries in addition to the part of
487c478bd9Sstevel@tonic-gate  * the page directory entry which also maps the initial text and data,
497c478bd9Sstevel@tonic-gate  * and makes the default slightly bigger than the 8MB on SPARC.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #ifdef __amd64
527c478bd9Sstevel@tonic-gate /*
53843e1988Sjohnlev  * On amd64, the stack grows down from just below KERNELBASE (see the
54843e1988Sjohnlev  * definition of USERLIMIT in i86pc/sys/machparam.h). Theoretically,
55843e1988Sjohnlev  * it could grow down to the top of the VA hole (0xffff800000000000),
56843e1988Sjohnlev  * giving it a possible maximum of about 125T. For an amd64 xpv
57843e1988Sjohnlev  * kernel, all user VA space is below the VA hole. The theoretical
58843e1988Sjohnlev  * maximum for the stack is about the same, although it can't grow
59843e1988Sjohnlev  * to quite that size, since it would clash with the heap.
60843e1988Sjohnlev  *
61843e1988Sjohnlev  * Pick an upper limit that will work in both cases: 32T.
62843e1988Sjohnlev  *
63843e1988Sjohnlev  * For 32bit processes, the stack is below the text segment.
647c478bd9Sstevel@tonic-gate  */
65843e1988Sjohnlev #define	MAXSSIZ		(32ULL * 1024ULL * 1024ULL * 1024ULL * 1024ULL)
667c478bd9Sstevel@tonic-gate #else
677c478bd9Sstevel@tonic-gate #define	MAXSSIZ		(USRSTACK - 1024*1024)
68843e1988Sjohnlev #endif /* __amd64 */
697c478bd9Sstevel@tonic-gate #define	DFLSSIZ		(8*1024*1024 + ((USRSTACK) & 0x3FFFFF))
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * Size of the kernel segkmem system pte table.  This virtual
737c478bd9Sstevel@tonic-gate  * space is controlled by the resource map "kernelmap".
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate #define	SYSPTSIZE	((61*1024*1024) / MMU_PAGESIZE)
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Size of the ethernet addressable kernel segkmem system pte table.
797c478bd9Sstevel@tonic-gate  * This virtual space is controlled by the resource map "ekernelmap".
807c478bd9Sstevel@tonic-gate  * The ethernet interfaces in some sun machines can address only
817c478bd9Sstevel@tonic-gate  * the upper 16 Megabytes of memory.  Since the ethernet
827c478bd9Sstevel@tonic-gate  * driver kmem_allocs its memory, we bias all kmem_allocs
837c478bd9Sstevel@tonic-gate  * to try ekernelmap first and if it fails try kernelmap.
847c478bd9Sstevel@tonic-gate  * Folks that allocate directly out of kernelmap, above,
857c478bd9Sstevel@tonic-gate  * get memory that is non-ethernet addressable.
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate #define	E_SYSPTSIZE	(0x2000000 / MMU_PAGESIZE)
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate  * The virtual address space to be used by the seg_map segment
917c478bd9Sstevel@tonic-gate  * driver for fast kernel mappings.
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate #if defined(__i386)
947c478bd9Sstevel@tonic-gate #define	SEGMAPDEFAULT	(16 * 1024 * 1024)
957c478bd9Sstevel@tonic-gate #define	SEGMAPMAX	(128 * 1024 * 1024)
967c478bd9Sstevel@tonic-gate #else
977c478bd9Sstevel@tonic-gate #define	SEGMAPDEFAULT	(64 * 1024 * 1024)
987c478bd9Sstevel@tonic-gate #endif
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * The time for a process to be blocked before being very swappable.
1027c478bd9Sstevel@tonic-gate  * This is a number of seconds which the system takes as being a non-trivial
1037c478bd9Sstevel@tonic-gate  * amount of real time. You probably shouldn't change this;
1047c478bd9Sstevel@tonic-gate  * it is used in subtle ways (fractions and multiples of it are, that is, like
1057c478bd9Sstevel@tonic-gate  * half of a ``long time'', almost a long time, etc.)
1067c478bd9Sstevel@tonic-gate  * It is related to human patience and other factors which don't really
1077c478bd9Sstevel@tonic-gate  * change over time.
1087c478bd9Sstevel@tonic-gate  */
109*71cf2822SAndy Fiddaman #define	MAXSLP		20
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /*
1127c478bd9Sstevel@tonic-gate  * A swapped in process is given a small amount of core without being bothered
1137c478bd9Sstevel@tonic-gate  * by the page replacement algorithm. Basically this says that if you are
1147c478bd9Sstevel@tonic-gate  * swapped in you deserve some resources. We protect the last SAFERSS
1157c478bd9Sstevel@tonic-gate  * pages against paging and will just swap you out rather than paging you.
1167c478bd9Sstevel@tonic-gate  * Note that each process has at least UPAGES pages which are not
1177c478bd9Sstevel@tonic-gate  * paged anyways so this number just means a swapped in process is
1187c478bd9Sstevel@tonic-gate  * given around 32k bytes.
1197c478bd9Sstevel@tonic-gate  */
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * nominal ``small'' resident set size
1227c478bd9Sstevel@tonic-gate  * protected against replacement
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate #define	SAFERSS		3
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate /*
1277c478bd9Sstevel@tonic-gate  * DISKRPM is used to estimate the number of paging i/o operations
1287c478bd9Sstevel@tonic-gate  * which one can expect from a single disk controller.
1297c478bd9Sstevel@tonic-gate  *
1307c478bd9Sstevel@tonic-gate  * XXX - The system doesn't account for multiple swap devices.
1317c478bd9Sstevel@tonic-gate  */
132*71cf2822SAndy Fiddaman #define	DISKRPM		600
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate /*
1357c478bd9Sstevel@tonic-gate  * The maximum value for handspreadpages which is the the distance
1367c478bd9Sstevel@tonic-gate  * between the two clock hands in pages.
1377c478bd9Sstevel@tonic-gate  */
1387c478bd9Sstevel@tonic-gate #define	MAXHANDSPREADPAGES	((64 * 1024 * 1024) / PAGESIZE)
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate /*
1417c478bd9Sstevel@tonic-gate  * Paged text files that are less than PGTHRESH bytes
1427c478bd9Sstevel@tonic-gate  * may be "prefaulted in" instead of demand paged.
1437c478bd9Sstevel@tonic-gate  */
1447c478bd9Sstevel@tonic-gate #define	PGTHRESH	(280 * 1024)
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1477c478bd9Sstevel@tonic-gate }
1487c478bd9Sstevel@tonic-gate #endif
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #endif	/* _SYS_VM_MACHPARAM_H */
151