4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
25 */
26
27 #include <sys/types.h>
28 #include <sys/param.h>
29 #include <sys/sysmacros.h>
30 #include <sys/signal.h>
31 #include <sys/stack.h>
32 #include <sys/pcb.h>
33 #include <sys/user.h>
34 #include <sys/systm.h>
35 #include <sys/sysinfo.h>
36 #include <sys/errno.h>
37 #include <sys/cmn_err.h>
38 #include <sys/cred.h>
39 #include <sys/resource.h>
40 #include <sys/task.h>
41 #include <sys/project.h>
42 #include <sys/proc.h>
43 #include <sys/debug.h>
103 id_t sysdccid = CLASS_UNUSED; /* reset when SDC loads */
104
105 void *segkp_thread; /* cookie for segkp pool */
106
107 int lwp_cache_sz = 32;
108 int t_cache_sz = 8;
109 static kt_did_t next_t_id = 1;
110
111 /* Default mode for thread binding to CPUs and processor sets */
112 int default_binding_mode = TB_ALLHARD;
113
114 /*
115 * Min/Max stack sizes for stack size parameters
116 */
117 #define MAX_STKSIZE (32 * DEFAULTSTKSZ)
118 #define MIN_STKSIZE DEFAULTSTKSZ
119
120 /*
121 * default_stksize overrides lwp_default_stksize if it is set.
122 */
123 int default_stksize;
124 int lwp_default_stksize;
125
126 static zone_key_t zone_thread_key;
127
128 unsigned int kmem_stackinfo; /* stackinfo feature on-off */
129 kmem_stkinfo_t *kmem_stkinfo_log; /* stackinfo circular log */
130 static kmutex_t kmem_stkinfo_lock; /* protects kmem_stkinfo_log */
131
132 /*
133 * forward declarations for internal thread specific data (tsd)
134 */
135 static void *tsd_realloc(void *, size_t, size_t);
136
137 void thread_reaper(void);
138
139 /* forward declarations for stackinfo feature */
140 static void stkinfo_begin(kthread_t *);
141 static void stkinfo_end(kthread_t *);
142 static size_t stkinfo_percent(caddr_t, caddr_t, caddr_t);
143
144 /*ARGSUSED*/
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
26 */
27
28 #include <sys/types.h>
29 #include <sys/param.h>
30 #include <sys/sysmacros.h>
31 #include <sys/signal.h>
32 #include <sys/stack.h>
33 #include <sys/pcb.h>
34 #include <sys/user.h>
35 #include <sys/systm.h>
36 #include <sys/sysinfo.h>
37 #include <sys/errno.h>
38 #include <sys/cmn_err.h>
39 #include <sys/cred.h>
40 #include <sys/resource.h>
41 #include <sys/task.h>
42 #include <sys/project.h>
43 #include <sys/proc.h>
44 #include <sys/debug.h>
104 id_t sysdccid = CLASS_UNUSED; /* reset when SDC loads */
105
106 void *segkp_thread; /* cookie for segkp pool */
107
108 int lwp_cache_sz = 32;
109 int t_cache_sz = 8;
110 static kt_did_t next_t_id = 1;
111
112 /* Default mode for thread binding to CPUs and processor sets */
113 int default_binding_mode = TB_ALLHARD;
114
115 /*
116 * Min/Max stack sizes for stack size parameters
117 */
118 #define MAX_STKSIZE (32 * DEFAULTSTKSZ)
119 #define MIN_STKSIZE DEFAULTSTKSZ
120
121 /*
122 * default_stksize overrides lwp_default_stksize if it is set.
123 */
124 volatile int default_stksize;
125 volatile int lwp_default_stksize;
126
127 static zone_key_t zone_thread_key;
128
129 unsigned int kmem_stackinfo; /* stackinfo feature on-off */
130 kmem_stkinfo_t *kmem_stkinfo_log; /* stackinfo circular log */
131 static kmutex_t kmem_stkinfo_lock; /* protects kmem_stkinfo_log */
132
133 /*
134 * forward declarations for internal thread specific data (tsd)
135 */
136 static void *tsd_realloc(void *, size_t, size_t);
137
138 void thread_reaper(void);
139
140 /* forward declarations for stackinfo feature */
141 static void stkinfo_begin(kthread_t *);
142 static void stkinfo_end(kthread_t *);
143 static size_t stkinfo_percent(caddr_t, caddr_t, caddr_t);
144
145 /*ARGSUSED*/
|