xref: /titanic_50/usr/src/uts/common/sys/ts.h (revision 2c164fafa089aa352e513b095e1ecd0abd29c61f)
1 /*
2  * CDDL HEADER START
3  *
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 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  * Copyright 2019 Joyent, Inc.
26  */
27 
28 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
29 /*	  All Rights Reserved  	*/
30 
31 
32 #ifndef _SYS_TS_H
33 #define	_SYS_TS_H
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.5 */
36 
37 #include <sys/types.h>
38 #include <sys/thread.h>
39 #include <sys/cpucaps.h>
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * time-sharing dispatcher parameter table entry
47  */
48 typedef struct tsdpent {
49 	pri_t	ts_globpri;	/* global (class independent) priority */
50 	int	ts_quantum;	/* time quantum given to procs at this level */
51 	pri_t	ts_tqexp;	/* ts_umdpri assigned when proc at this level */
52 				/*   exceeds its time quantum */
53 	pri_t	ts_slpret;	/* ts_umdpri assigned when proc at this level */
54 				/*  returns to user mode after sleeping */
55 	short	ts_maxwait;	/* bumped to ts_lwait if more than ts_maxwait */
56 				/*  secs elapse before receiving full quantum */
57 	short	ts_lwait;	/* ts_umdpri assigned if ts_dispwait exceeds  */
58 				/*  ts_maxwait */
59 } tsdpent_t;
60 
61 #ifdef _KERNEL
62 /*
63  * time-sharing class specific thread structure
64  */
65 typedef struct tsproc {
66 	int	ts_timeleft;	/* time remaining in procs quantum	*/
67 	uint_t	ts_dispwait;	/* wall clock seconds since start	*/
68 				/* of quantum (not reset upon preempt)	*/
69 	pri_t	ts_cpupri;	/* system controlled component of ts_umdpri */
70 	pri_t	ts_uprilim;	/* user priority limit			*/
71 	pri_t	ts_upri;	/* user priority			*/
72 	pri_t	ts_umdpri;	/* user mode priority within ts class	*/
73 	pri_t	ts_scpri;	/* remembered priority, for schedctl	*/
74 	char	ts_nice;	/* nice value for compatibility		*/
75 	char	ts_boost;	/* interactive priority offset		*/
76 	uchar_t	ts_flags;	/* flags defined below			*/
77 	kthread_t *ts_tp;	/* pointer to thread			*/
78 	struct tsproc *ts_next;	/* link to next tsproc on list		*/
79 	struct tsproc *ts_prev;	/* link to previous tsproc on list	*/
80 	caps_sc_t ts_caps;	/* CPU caps specific data		*/
81 } tsproc_t;
82 
83 /* flags */
84 #define	TSBACKQ		0x02	/* thread goes to back of dispq if preempted */
85 #define	TSIA		0x04	/* thread is interactive		*/
86 #define	TSIASET		0x08	/* interactive thread is "on"		*/
87 #define	TSIANICED	0x10	/* interactive thread has been niced	*/
88 #define	TSRESTORE	0x20	/* thread was not preempted, due to schedctl */
89 				/* restore priority from ts_scpri	*/
90 
91 #endif /* _KERNEL */
92 
93 #ifdef	__cplusplus
94 }
95 #endif
96 
97 #endif	/* _SYS_TS_H */
98