Print this page
6583 remove whole-process swapping
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/class.h
+++ new/usr/src/uts/common/sys/class.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 *
26 26 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
27 27 */
28 28
29 29 /* Copyright (c) 1988 AT&T */
30 30 /* All Rights Reserved */
31 31
32 32 #ifndef _SYS_CLASS_H
33 33 #define _SYS_CLASS_H
34 34
35 35 #include <sys/t_lock.h>
36 36 #include <sys/cred.h>
37 37 #include <sys/thread.h>
38 38 #include <sys/priocntl.h>
39 39 #include <sys/mutex.h>
40 40 #include <sys/uio.h>
41 41
42 42 #ifdef __cplusplus
43 43 extern "C" {
44 44 #endif
45 45
46 46 /*
47 47 * NOTE: Developers making use of the scheduler class switch mechanism
48 48 * to develop scheduling class modules should be aware that the
49 49 * architecture is not frozen and the kernel interface for scheduling
50 50 * class modules may change in future releases of System V. Support
51 51 * for the current interface is not guaranteed and class modules
52 52 * developed to this interface may require changes in order to work
53 53 * with future releases of the system.
54 54 */
55 55
56 56 /*
57 57 * three different ops vectors are bundled together, here.
58 58 * one is for each of the fundamental objects acted upon
59 59 * by these operators: procs, threads, and the class manager itself.
60 60 */
61 61
62 62 typedef struct class_ops {
63 63 int (*cl_admin)(caddr_t, cred_t *);
64 64 int (*cl_getclinfo)(void *);
65 65 int (*cl_parmsin)(void *);
66 66 int (*cl_parmsout)(void *, pc_vaparms_t *);
67 67 int (*cl_vaparmsin)(void *, pc_vaparms_t *);
68 68 int (*cl_vaparmsout)(void *, pc_vaparms_t *);
69 69 int (*cl_getclpri)(pcpri_t *);
70 70 int (*cl_alloc)(void **, int);
71 71 void (*cl_free)(void *);
72 72 } class_ops_t;
73 73
74 74 typedef struct thread_ops {
75 75 int (*cl_enterclass)(kthread_t *, id_t, void *, cred_t *, void *);
↓ open down ↓ |
75 lines elided |
↑ open up ↑ |
76 76 void (*cl_exitclass)(void *);
77 77 int (*cl_canexit)(kthread_t *, cred_t *);
78 78 int (*cl_fork)(kthread_t *, kthread_t *, void *);
79 79 void (*cl_forkret)(kthread_t *, kthread_t *);
80 80 void (*cl_parmsget)(kthread_t *, void *);
81 81 int (*cl_parmsset)(kthread_t *, void *, id_t, cred_t *);
82 82 void (*cl_stop)(kthread_t *, int, int);
83 83 void (*cl_exit)(kthread_t *);
84 84 void (*cl_active)(kthread_t *);
85 85 void (*cl_inactive)(kthread_t *);
86 - pri_t (*cl_swapin)(kthread_t *, int);
87 - pri_t (*cl_swapout)(kthread_t *, int);
88 86 void (*cl_trapret)(kthread_t *);
89 87 void (*cl_preempt)(kthread_t *);
90 88 void (*cl_setrun)(kthread_t *);
91 89 void (*cl_sleep)(kthread_t *);
92 90 void (*cl_tick)(kthread_t *);
93 91 void (*cl_wakeup)(kthread_t *);
94 92 int (*cl_donice)(kthread_t *, cred_t *, int, int *);
95 93 pri_t (*cl_globpri)(kthread_t *);
96 94 void (*cl_set_process_group)(pid_t, pid_t, pid_t);
97 95 void (*cl_yield)(kthread_t *);
98 96 int (*cl_doprio)(kthread_t *, cred_t *, int, int *);
99 97 } thread_ops_t;
100 98
101 99 typedef struct classfuncs {
102 100 class_ops_t sclass;
103 101 thread_ops_t thread;
104 102 } classfuncs_t;
105 103
106 104 typedef struct sclass {
107 105 char *cl_name; /* class name */
108 106 /* class specific initialization function */
109 107 pri_t (*cl_init)(id_t, int, classfuncs_t **);
110 108 classfuncs_t *cl_funcs; /* pointer to classfuncs structure */
111 109 krwlock_t *cl_lock; /* class structure read/write lock */
112 110 int cl_count; /* # of threads trying to load class */
113 111 } sclass_t;
114 112
115 113 #define STATIC_SCHED (krwlock_t *)0xffffffff
116 114 #define LOADABLE_SCHED(s) ((s)->cl_lock != STATIC_SCHED)
117 115 #define SCHED_INSTALLED(s) ((s)->cl_funcs != NULL)
118 116 #define ALLOCATED_SCHED(s) ((s)->cl_lock != NULL)
119 117
120 118 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
121 119
122 120 #define CLASS_KERNEL(cid) ((cid) == syscid || (cid) == sysdccid)
123 121
124 122 extern int nclass; /* number of configured scheduling classes */
125 123 extern char *defaultclass; /* default class for newproc'd processes */
126 124 extern struct sclass sclass[]; /* the class table */
127 125 extern kmutex_t class_lock; /* lock protecting class table */
128 126 extern int loaded_classes; /* number of classes loaded */
129 127
130 128 extern pri_t minclsyspri;
131 129 extern id_t syscid; /* system scheduling class ID */
132 130 extern id_t sysdccid; /* system duty-cycle scheduling class ID */
133 131 extern id_t defaultcid; /* "default" class id; see dispadmin(1M) */
134 132
135 133 extern int alloc_cid(char *, id_t *);
136 134 extern int scheduler_load(char *, sclass_t *);
137 135 extern int getcid(char *, id_t *);
138 136 extern int getcidbyname(char *, id_t *);
139 137 extern int parmsin(pcparms_t *, pc_vaparms_t *);
140 138 extern int parmsout(pcparms_t *, pc_vaparms_t *);
141 139 extern int parmsset(pcparms_t *, kthread_t *);
142 140 extern void parmsget(kthread_t *, pcparms_t *);
143 141 extern int vaparmsout(char *, pcparms_t *, pc_vaparms_t *, uio_seg_t);
144 142
145 143 #endif
146 144
147 145 #define CL_ADMIN(clp, uaddr, reqpcredp) \
148 146 (*(clp)->cl_funcs->sclass.cl_admin)(uaddr, reqpcredp)
149 147
150 148 #define CL_ENTERCLASS(t, cid, clparmsp, credp, bufp) \
151 149 (sclass[cid].cl_funcs->thread.cl_enterclass) (t, cid, \
152 150 (void *)clparmsp, credp, bufp)
153 151
154 152 #define CL_EXITCLASS(cid, clprocp)\
155 153 (sclass[cid].cl_funcs->thread.cl_exitclass) ((void *)clprocp)
156 154
157 155 #define CL_CANEXIT(t, cr) (*(t)->t_clfuncs->cl_canexit)(t, cr)
158 156
159 157 #define CL_FORK(tp, ct, bufp) (*(tp)->t_clfuncs->cl_fork)(tp, ct, bufp)
160 158
161 159 #define CL_FORKRET(t, ct) (*(t)->t_clfuncs->cl_forkret)(t, ct)
162 160
163 161 #define CL_GETCLINFO(clp, clinfop) \
164 162 (*(clp)->cl_funcs->sclass.cl_getclinfo)((void *)clinfop)
165 163
166 164 #define CL_GETCLPRI(clp, clprip) \
167 165 (*(clp)->cl_funcs->sclass.cl_getclpri)(clprip)
168 166
169 167 #define CL_PARMSGET(t, clparmsp) \
170 168 (*(t)->t_clfuncs->cl_parmsget)(t, (void *)clparmsp)
171 169
172 170 #define CL_PARMSIN(clp, clparmsp) \
173 171 (clp)->cl_funcs->sclass.cl_parmsin((void *)clparmsp)
174 172
175 173 #define CL_PARMSOUT(clp, clparmsp, vaparmsp) \
176 174 (clp)->cl_funcs->sclass.cl_parmsout((void *)clparmsp, vaparmsp)
177 175
178 176 #define CL_VAPARMSIN(clp, clparmsp, vaparmsp) \
179 177 (clp)->cl_funcs->sclass.cl_vaparmsin((void *)clparmsp, vaparmsp)
180 178
181 179 #define CL_VAPARMSOUT(clp, clparmsp, vaparmsp) \
182 180 (clp)->cl_funcs->sclass.cl_vaparmsout((void *)clparmsp, vaparmsp)
183 181
184 182 #define CL_PARMSSET(t, clparmsp, cid, curpcredp) \
185 183 (*(t)->t_clfuncs->cl_parmsset)(t, (void *)clparmsp, cid, curpcredp)
186 184
187 185 #define CL_PREEMPT(tp) (*(tp)->t_clfuncs->cl_preempt)(tp)
188 186
189 187 #define CL_SETRUN(tp) (*(tp)->t_clfuncs->cl_setrun)(tp)
↓ open down ↓ |
92 lines elided |
↑ open up ↑ |
190 188
191 189 #define CL_SLEEP(tp) (*(tp)->t_clfuncs->cl_sleep)(tp)
192 190
193 191 #define CL_STOP(t, why, what) (*(t)->t_clfuncs->cl_stop)(t, why, what)
194 192
195 193 #define CL_EXIT(t) (*(t)->t_clfuncs->cl_exit)(t)
196 194
197 195 #define CL_ACTIVE(t) (*(t)->t_clfuncs->cl_active)(t)
198 196
199 197 #define CL_INACTIVE(t) (*(t)->t_clfuncs->cl_inactive)(t)
200 -
201 -#define CL_SWAPIN(t, flags) (*(t)->t_clfuncs->cl_swapin)(t, flags)
202 -
203 -#define CL_SWAPOUT(t, flags) (*(t)->t_clfuncs->cl_swapout)(t, flags)
204 198
205 199 #define CL_TICK(t) (*(t)->t_clfuncs->cl_tick)(t)
206 200
207 201 #define CL_TRAPRET(t) (*(t)->t_clfuncs->cl_trapret)(t)
208 202
209 203 #define CL_WAKEUP(t) (*(t)->t_clfuncs->cl_wakeup)(t)
210 204
211 205 #define CL_DONICE(t, cr, inc, ret) \
212 206 (*(t)->t_clfuncs->cl_donice)(t, cr, inc, ret)
213 207
214 208 #define CL_DOPRIO(t, cr, inc, ret) \
215 209 (*(t)->t_clfuncs->cl_doprio)(t, cr, inc, ret)
216 210
217 211 #define CL_GLOBPRI(t) (*(t)->t_clfuncs->cl_globpri)(t)
218 212
219 213 #define CL_SET_PROCESS_GROUP(t, s, b, f) \
220 214 (*(t)->t_clfuncs->cl_set_process_group)(s, b, f)
221 215
222 216 #define CL_YIELD(tp) (*(tp)->t_clfuncs->cl_yield)(tp)
223 217
224 218 #define CL_ALLOC(pp, cid, flag) \
225 219 (sclass[cid].cl_funcs->sclass.cl_alloc) (pp, flag)
226 220
227 221 #define CL_FREE(cid, bufp) (sclass[cid].cl_funcs->sclass.cl_free) (bufp)
228 222
229 223 #ifdef __cplusplus
230 224 }
231 225 #endif
232 226
233 227 #endif /* _SYS_CLASS_H */
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX