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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28
29
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <sys/sysmacros.h>
33 #include <sys/signal.h>
34 #include <sys/user.h>
35 #include <sys/systm.h>
36 #include <sys/sysinfo.h>
37 #include <sys/var.h>
38 #include <sys/errno.h>
39 #include <sys/cmn_err.h>
40 #include <sys/debug.h>
41 #include <sys/inline.h>
42 #include <sys/disp.h>
43 #include <sys/class.h>
44 #include <sys/bitmap.h>
103 static void cpu_resched(cpu_t *cp, pri_t tpri);
104
105 /*
106 * If this is set, only interrupt threads will cause kernel preemptions.
107 * This is done by changing the value of kpreemptpri. kpreemptpri
108 * will either be the max sysclass pri + 1 or the min interrupt pri.
109 */
110 int only_intr_kpreempt;
111
112 extern void set_idle_cpu(int cpun);
113 extern void unset_idle_cpu(int cpun);
114 static void setkpdq(kthread_t *tp, int borf);
115 #define SETKP_BACK 0
116 #define SETKP_FRONT 1
117 /*
118 * Parameter that determines how recently a thread must have run
119 * on the CPU to be considered loosely-bound to that CPU to reduce
120 * cold cache effects. The interval is in hertz.
121 */
122 #define RECHOOSE_INTERVAL 3
123 int rechoose_interval = RECHOOSE_INTERVAL;
124
125 /*
126 * Parameter that determines how long (in nanoseconds) a thread must
127 * be sitting on a run queue before it can be stolen by another CPU
128 * to reduce migrations. The interval is in nanoseconds.
129 *
130 * The nosteal_nsec should be set by platform code cmp_set_nosteal_interval()
131 * to an appropriate value. nosteal_nsec is set to NOSTEAL_UNINITIALIZED
132 * here indicating it is uninitiallized.
133 * Setting nosteal_nsec to 0 effectively disables the nosteal 'protection'.
134 *
135 */
136 #define NOSTEAL_UNINITIALIZED (-1)
137 hrtime_t nosteal_nsec = NOSTEAL_UNINITIALIZED;
138 extern void cmp_set_nosteal_interval(void);
139
140 id_t defaultcid; /* system "default" class; see dispadmin(1M) */
141
142 disp_lock_t transition_lock; /* lock on transitioning threads */
143 disp_lock_t stop_lock; /* lock on stopped threads */
|
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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
31
32
33 #include <sys/types.h>
34 #include <sys/param.h>
35 #include <sys/sysmacros.h>
36 #include <sys/signal.h>
37 #include <sys/user.h>
38 #include <sys/systm.h>
39 #include <sys/sysinfo.h>
40 #include <sys/var.h>
41 #include <sys/errno.h>
42 #include <sys/cmn_err.h>
43 #include <sys/debug.h>
44 #include <sys/inline.h>
45 #include <sys/disp.h>
46 #include <sys/class.h>
47 #include <sys/bitmap.h>
106 static void cpu_resched(cpu_t *cp, pri_t tpri);
107
108 /*
109 * If this is set, only interrupt threads will cause kernel preemptions.
110 * This is done by changing the value of kpreemptpri. kpreemptpri
111 * will either be the max sysclass pri + 1 or the min interrupt pri.
112 */
113 int only_intr_kpreempt;
114
115 extern void set_idle_cpu(int cpun);
116 extern void unset_idle_cpu(int cpun);
117 static void setkpdq(kthread_t *tp, int borf);
118 #define SETKP_BACK 0
119 #define SETKP_FRONT 1
120 /*
121 * Parameter that determines how recently a thread must have run
122 * on the CPU to be considered loosely-bound to that CPU to reduce
123 * cold cache effects. The interval is in hertz.
124 */
125 #define RECHOOSE_INTERVAL 3
126 volatile int rechoose_interval = RECHOOSE_INTERVAL;
127
128 /*
129 * Parameter that determines how long (in nanoseconds) a thread must
130 * be sitting on a run queue before it can be stolen by another CPU
131 * to reduce migrations. The interval is in nanoseconds.
132 *
133 * The nosteal_nsec should be set by platform code cmp_set_nosteal_interval()
134 * to an appropriate value. nosteal_nsec is set to NOSTEAL_UNINITIALIZED
135 * here indicating it is uninitiallized.
136 * Setting nosteal_nsec to 0 effectively disables the nosteal 'protection'.
137 *
138 */
139 #define NOSTEAL_UNINITIALIZED (-1)
140 hrtime_t nosteal_nsec = NOSTEAL_UNINITIALIZED;
141 extern void cmp_set_nosteal_interval(void);
142
143 id_t defaultcid; /* system "default" class; see dispadmin(1M) */
144
145 disp_lock_t transition_lock; /* lock on transitioning threads */
146 disp_lock_t stop_lock; /* lock on stopped threads */
|