1 /* 2 * Copyright 1991-1998 by Open Software Foundation, Inc. 3 * All Rights Reserved 4 * 5 * Permission to use, copy, modify, and distribute this software and 6 * its documentation for any purpose and without fee is hereby granted, 7 * provided that the above copyright notice appears in all copies and 8 * that both the copyright notice and this permission notice appear in 9 * supporting documentation. 10 * 11 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 12 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 * FOR A PARTICULAR PURPOSE. 14 * 15 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 16 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 17 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 18 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 19 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 */ 21 /* 22 * MkLinux 23 */ 24 /* CMU_HIST */ 25 /* 26 * Revision 2.4 91/05/14 16:58:29 mrt 27 * Correcting copyright 28 * 29 * Revision 2.3 91/02/05 17:35:22 mrt 30 * Changed to new Mach copyright 31 * [91/02/01 17:20:11 mrt] 32 * 33 * Revision 2.2 90/06/02 14:59:37 rpd 34 * Created for new host/processor technology. 35 * [90/03/26 23:51:22 rpd] 36 * 37 * Cleanup changes. 38 * [89/08/02 dlb] 39 * Created. 40 * [89/07/25 18:47:00 dlb] 41 * 42 * Revision 2.3 89/10/15 02:05:50 rpd 43 * Minor cleanups. 44 * 45 * Revision 2.2 89/10/11 14:40:53 dlb 46 * Cleanup changes. 47 * [89/08/02 dlb] 48 * 49 */ 50 /* CMU_ENDHIST */ 51 /* 52 * Mach Operating System 53 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University 54 * All Rights Reserved. 55 * 56 * Permission to use, copy, modify and distribute this software and its 57 * documentation is hereby granted, provided that both the copyright 58 * notice and this permission notice appear in all copies of the 59 * software, derivative works or modified versions, and any portions 60 * thereof, and that both notices appear in supporting documentation. 61 * 62 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 63 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 64 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 65 * 66 * Carnegie Mellon requests users of this software to return to 67 * 68 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 69 * School of Computer Science 70 * Carnegie Mellon University 71 * Pittsburgh PA 15213-3890 72 * 73 * any improvements or extensions that they make and grant Carnegie Mellon 74 * the rights to redistribute these changes. 75 */ 76 /* 77 */ 78 79 #ifndef _MACH_POLICY_H_ 80 #define _MACH_POLICY_H_ 81 82 /* 83 * mach/policy.h 84 * 85 * Definitions for scheduing policy. 86 */ 87 88 #include <sys/mach/vm_types.h> 89 90 /* 91 * Policy definitions. Policies should be powers of 2, 92 * but cannot be or'd together other than to test for a 93 * policy 'class'. 94 */ 95 #define POLICY_TIMESHARE 1 /* timesharing */ 96 #define POLICY_RR 2 /* fixed round robin */ 97 #define POLICY_FIFO 4 /* fixed fifo */ 98 99 /* 100 * Check if policy is of 'class' fixed-priority. 101 */ 102 #define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO) 103 104 /* 105 * Check if policy is valid. 106 */ 107 #define invalid_policy(policy) \ 108 ((policy) != POLICY_TIMESHARE && \ 109 (policy) != POLICY_RR && \ 110 (policy) != POLICY_FIFO) 111 112 113 /* 114 * New scheduling control interface 115 */ 116 typedef int policy_t; 117 typedef integer_t *policy_info_t; 118 typedef integer_t *policy_base_t; 119 typedef integer_t *policy_limit_t; 120 121 122 /* 123 * Types for TIMESHARE policy 124 */ 125 struct policy_timeshare_base { 126 integer_t base_priority; 127 }; 128 struct policy_timeshare_limit { 129 integer_t max_priority; 130 }; 131 struct policy_timeshare_info { 132 integer_t max_priority; 133 integer_t base_priority; 134 integer_t cur_priority; 135 boolean_t depressed; 136 integer_t depress_priority; 137 }; 138 139 typedef struct policy_timeshare_base *policy_timeshare_base_t; 140 typedef struct policy_timeshare_limit *policy_timeshare_limit_t; 141 typedef struct policy_timeshare_info *policy_timeshare_info_t; 142 143 typedef struct policy_timeshare_base policy_timeshare_base_data_t; 144 typedef struct policy_timeshare_limit policy_timeshare_limit_data_t; 145 typedef struct policy_timeshare_info policy_timeshare_info_data_t; 146 147 148 #define POLICY_TIMESHARE_BASE_COUNT \ 149 (sizeof(struct policy_timeshare_base)/sizeof(integer_t)) 150 #define POLICY_TIMESHARE_LIMIT_COUNT \ 151 (sizeof(struct policy_timeshare_limit)/sizeof(integer_t)) 152 #define POLICY_TIMESHARE_INFO_COUNT \ 153 (sizeof(struct policy_timeshare_info)/sizeof(integer_t)) 154 155 156 /* 157 * Types for the ROUND ROBIN (RR) policy 158 */ 159 struct policy_rr_base { 160 integer_t base_priority; 161 integer_t quantum; 162 }; 163 struct policy_rr_limit { 164 integer_t max_priority; 165 }; 166 struct policy_rr_info { 167 integer_t max_priority; 168 integer_t base_priority; 169 integer_t quantum; 170 boolean_t depressed; 171 integer_t depress_priority; 172 }; 173 174 typedef struct policy_rr_base *policy_rr_base_t; 175 typedef struct policy_rr_limit *policy_rr_limit_t; 176 typedef struct policy_rr_info *policy_rr_info_t; 177 178 typedef struct policy_rr_base policy_rr_base_data_t; 179 typedef struct policy_rr_limit policy_rr_limit_data_t; 180 typedef struct policy_rr_info policy_rr_info_data_t; 181 182 #define POLICY_RR_BASE_COUNT \ 183 (sizeof(struct policy_rr_base)/sizeof(integer_t)) 184 #define POLICY_RR_LIMIT_COUNT \ 185 (sizeof(struct policy_rr_limit)/sizeof(integer_t)) 186 #define POLICY_RR_INFO_COUNT \ 187 (sizeof(struct policy_rr_info)/sizeof(integer_t)) 188 189 190 /* 191 * Types for the FIRST-IN-FIRST-OUT (FIFO) policy 192 */ 193 struct policy_fifo_base { 194 integer_t base_priority; 195 }; 196 struct policy_fifo_limit { 197 integer_t max_priority; 198 }; 199 struct policy_fifo_info { 200 integer_t max_priority; 201 integer_t base_priority; 202 boolean_t depressed; 203 integer_t depress_priority; 204 }; 205 206 typedef struct policy_fifo_base *policy_fifo_base_t; 207 typedef struct policy_fifo_limit *policy_fifo_limit_t; 208 typedef struct policy_fifo_info *policy_fifo_info_t; 209 210 typedef struct policy_fifo_base policy_fifo_base_data_t; 211 typedef struct policy_fifo_limit policy_fifo_limit_data_t; 212 typedef struct policy_fifo_info policy_fifo_info_data_t; 213 214 #define POLICY_FIFO_BASE_COUNT \ 215 (sizeof(struct policy_fifo_base)/sizeof(integer_t)) 216 #define POLICY_FIFO_LIMIT_COUNT \ 217 (sizeof(struct policy_fifo_limit)/sizeof(integer_t)) 218 #define POLICY_FIFO_INFO_COUNT \ 219 (sizeof(struct policy_fifo_info)/sizeof(integer_t)) 220 221 222 /* 223 * Aggregate policy types 224 */ 225 226 struct policy_bases { 227 policy_timeshare_base_data_t ts; 228 policy_rr_base_data_t rr; 229 policy_fifo_base_data_t fifo; 230 }; 231 232 struct policy_limits { 233 policy_timeshare_limit_data_t ts; 234 policy_rr_limit_data_t rr; 235 policy_fifo_limit_data_t fifo; 236 }; 237 238 struct policy_infos { 239 policy_timeshare_info_data_t ts; 240 policy_rr_info_data_t rr; 241 policy_fifo_info_data_t fifo; 242 }; 243 244 typedef struct policy_bases policy_base_data_t; 245 typedef struct policy_limits policy_limit_data_t; 246 typedef struct policy_infos policy_info_data_t; 247 248 249 #endif /* _MACH_POLICY_H_ */ 250