PageRenderTime 51ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/usr/src/man/man4/fx_dptbl.4

https://bitbucket.org/illumos/illumos-gate/
Forth | 410 lines | 381 code | 29 blank | 0 comment | 22 complexity | c04417ede0cbcc4c7b9e6104cad9a04f MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, AGPL-1.0, AGPL-3.0, BSD-3-Clause, GPL-3.0, LGPL-2.1, BSD-2-Clause, MPL-2.0-no-copyleft-exception, GPL-2.0, 0BSD
  1. '\" te
  2. .\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
  3. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
  4. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
  5. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  6. .TH FX_DPTBL 4 "Oct 15, 2002"
  7. .SH NAME
  8. fx_dptbl \- fixed priority dispatcher parameter table
  9. .SH SYNOPSIS
  10. .LP
  11. .nf
  12. \fBfx_dptbl\fR
  13. .fi
  14. .SH DESCRIPTION
  15. .sp
  16. .LP
  17. The process scheduler or dispatcher is the portion of the kernel that controls
  18. allocation of the CPU to processes. The scheduler supports the notion of
  19. scheduling classes, where each class defines a scheduling policy used to
  20. schedule processes within that class. Associated with each scheduling class is
  21. a set of priority queues on which ready-to-run processes are linked. These
  22. priority queues are mapped by the system configuration into a set of global
  23. scheduling priorities, which are available to processes within the class. The
  24. dispatcher always selects for execution the process with the highest global
  25. scheduling priority in the system. The priority queues associated with a given
  26. class are viewed by that class as a contiguous set of priority levels numbered
  27. from 0 (lowest priority) to \fIn\fR (highest priority\(ema
  28. configuration-dependent value). The set of global scheduling priorities that
  29. the queues for a given class are mapped into might not start at zero and might
  30. not be contiguous, depending on the configuration.
  31. .sp
  32. .LP
  33. Processes in the fixed priority class are scheduled according to the parameters
  34. in a fixed-priority dispatcher parameter table (\fBfx_dptbl\fR). The
  35. \fBfx_dptbl\fR table consists of an array (\fBconfig_fx_dptbl[]\fR) of
  36. parameter structures (\fBstruct fxdpent_t\fR), one for each of the \fIn\fR
  37. priority levels used by fixed priority processes in user mode. The structures
  38. are accessed by way of a pointer, (\fBfx_dptbl\fR), to the array. The
  39. properties of a given priority level \fIi\fR are specified by the \fIi\fRth
  40. parameter structure in this array (\fBfx_dptbl[\fIi\fR]\fR).
  41. .sp
  42. .LP
  43. A parameter structure consists of the following members. These are also
  44. described in the \fB/usr/include/sys/fx.h\fR header.
  45. .sp
  46. .ne 2
  47. .na
  48. \fB\fBfx_globpri\fR\fR
  49. .ad
  50. .RS 14n
  51. The global scheduling priority associated with this priority level. The mapping
  52. between fixed-priority priority levels and global scheduling priorities is
  53. determined at boot time by the system configuration. \fBfx_globpri\fR can not
  54. be changed with \fBdispadmin\fR(1M).
  55. .RE
  56. .sp
  57. .ne 2
  58. .na
  59. \fB\fBfx_quantum\fR\fR
  60. .ad
  61. .RS 14n
  62. The length of the time quantum allocated to processes at this level in ticks
  63. (\fBhz\fR). The time quantum value is only a default or starting value for
  64. processes at a particular level, as the time quantum of a fixed priority
  65. process can be changed by the user with the \fBpriocntl\fR(1) command or the
  66. \fBpriocntl\fR(2) system call.
  67. .sp
  68. In the high resolution clock mode (\fBhires_tick\fR set to \fB1\fR), the value
  69. of \fBhz\fR is set to \fB1000\fR. Increase quantums to maintain the same
  70. absolute time quantums.
  71. .sp
  72. An administrator can affect the behavior of the fixed priority portion of the
  73. scheduler by reconfiguring the \fBfx_dptbl\fR. There are two methods available
  74. for doing this: reconfigure with a loadable module at boot-time or by using
  75. \fBdispadmin\fR(1M) at run-time.
  76. .RE
  77. .SS "fx_dptbl Loadable Module"
  78. .sp
  79. .LP
  80. The \fBfx_dptbl\fR can be reconfigured with a loadable module that contains a
  81. new fixed priority dispatch table. The module containing the dispatch table is
  82. separate from the \fBFX\fR loadable module, which contains the rest of the
  83. fixed priority software. This is the only method that can be used to change the
  84. number of fixed priority priority levels or the set of global scheduling
  85. priorities used by the fixed priority class. The relevant procedure and source
  86. code is described in Replacing the fx_dptbl Loadable Module below.
  87. .SS "dispadmin Configuration File"
  88. .sp
  89. .LP
  90. The \fBfx_quantum\fR values in the \fBfx_dptbl\fR can be examined and modified
  91. on a running system using the \fBdispadmin\fR(1M) command. Invoking
  92. \fBdispadmin\fR for the fixed-priority class allows the administrator to
  93. retrieve the current \fBfx_dptbl\fR configuration from the kernel's in-core
  94. table or overwrite the in-core table with values from a configuration file. The
  95. configuration file used for input to \fBdispadmin\fR must conform to the
  96. specific format described as follows:
  97. .RS +4
  98. .TP
  99. .ie t \(bu
  100. .el o
  101. Blank lines are ignored and any part of a line to the right of a # symbol is
  102. treated as a comment.
  103. .RE
  104. .RS +4
  105. .TP
  106. .ie t \(bu
  107. .el o
  108. The first non-blank, non-comment line must indicate the resolution to be used
  109. for interpreting the time quantum values. The resolution is specified as:
  110. .sp
  111. .in +2
  112. .nf
  113. RES=\fIres\fR
  114. .fi
  115. .in -2
  116. .sp
  117. where \fIres\fR is a positive integer between 1 and 1,000,000,000 inclusive and
  118. the resolution used is the reciprocal of \fIres\fR in seconds (for example,
  119. \fBRES=1000\fR specifies millisecond resolution). Although you can specify very
  120. fine (nanosecond) resolution, the time quantum lengths are rounded up to the
  121. next integral multiple of the system clock's resolution.
  122. .RE
  123. .RS +4
  124. .TP
  125. .ie t \(bu
  126. .el o
  127. The remaining lines in the file are used to specify the \fBfx_quantum\fR values
  128. for each of the fixed-priority priority levels. The first line specifies the
  129. quantum for fixed-priority level 0, the second line specifies the quantum for
  130. fixed-priority level 1, and so forth. There must be exactly one line for each
  131. configured fixed priority priority level. Each \fBfx_quantum\fR entry must be a
  132. positive integer specifying the desired time quantum in the resolution given by
  133. \fIres\fR.
  134. .RE
  135. .sp
  136. .LP
  137. See Examples for an example of an excerpt of a \fBdispadmin\fR configuration
  138. file.
  139. .SS "Replacing the fx_dptbl Loadable Module"
  140. .sp
  141. .LP
  142. To change the size of the fixed priority dispatch table, you must build the
  143. loadable module that contains the dispatch table information. Save the existing
  144. module before using the following procedure.
  145. .RS +4
  146. .TP
  147. 1.
  148. Place the dispatch table code shown below in a file called \fBfx_dptbl.c\fR.
  149. See EXAMPLES, below, for an example of this file.
  150. .RE
  151. .RS +4
  152. .TP
  153. 2.
  154. Compile the code using the given compilation and link lines supplied:
  155. .sp
  156. .in +2
  157. .nf
  158. cc -c -0 -D_KERNEL fx_dptbl.c
  159. ld -r -o FX_DPTBL fx_dptbl.o
  160. .fi
  161. .in -2
  162. .sp
  163. .RE
  164. .RS +4
  165. .TP
  166. 3.
  167. Copy the current dispatch table in \fB/usr/kernel/sched\fR to
  168. \fBFX_DPTBL.bak\fR.
  169. .RE
  170. .RS +4
  171. .TP
  172. 4.
  173. Replace the current \fBFX_DPTBL\fR in \fB/usr/kernel/sched\fR.
  174. .RE
  175. .RS +4
  176. .TP
  177. 5.
  178. Make changes in the \fB/etc/system\fR file to reflect the changes to the
  179. sizes of the tables. See \fBsystem\fR(4). The variables affected is
  180. \fBfx_maxupri\fR. The syntax for setting this is as follows:
  181. .sp
  182. .in +2
  183. .nf
  184. set FX:fx_maxupri=(\fIvalue for max fixed-priority user priority\fR)
  185. .fi
  186. .in -2
  187. .sp
  188. .RE
  189. .RS +4
  190. .TP
  191. 6.
  192. Reboot the system to use the new dispatch table.
  193. .RE
  194. .sp
  195. .LP
  196. Exercise great care in using the preceding method to replace the dispatch
  197. table. A mistake can result in panics, thus making the system unusable.
  198. .SH EXAMPLES
  199. .LP
  200. \fBExample 1 \fRConfiguration File Excerpt
  201. .sp
  202. .LP
  203. The following excerpt from a \fBdispadmin\fR configuration file illustrates the
  204. correct format. Note that, for each line specifying a set of parameters, there
  205. is a comment indicating the corresponding priority level. These level numbers
  206. indicate priority within the fixed priority class; the mapping between these
  207. fixed-priority priorities and the corresponding global scheduling priorities is
  208. determined by the configuration specified in the \fBFX_DPTBL\fR loadable
  209. module. The level numbers are strictly for the convenience of the administrator
  210. reading the file and, as with any comment, they are ignored by \fBdispadmin\fR.
  211. The \fBdispadmin\fR command assumes that the lines in the file are ordered by
  212. consecutive, increasing priority level (from 0 to the maximum configured
  213. fixed-priority priority). For the sake of someone reading the file, the level
  214. numbers in the comments should agree with this ordering. If for some reason
  215. they do not, \fBdispadmin\fR is unaffected.
  216. .sp
  217. .in +2
  218. .nf
  219. # Fixed Priority Dispatcher Configuration File RES=1000
  220. RES=1000
  221. # TIME QUANTUM PRIORITY
  222. # (fx_quantum) LEVEL
  223. 200 # 0
  224. 200 # 1
  225. 200 # 2
  226. 200 # 3
  227. 200 # 4
  228. 200 # 5
  229. 200 # 6
  230. 200 # 7
  231. . . .
  232. . . .
  233. . . .
  234. 20 # 58
  235. 20 # 59
  236. 20 # 60
  237. .fi
  238. .in -2
  239. .sp
  240. .LP
  241. \fBExample 2 \fR\fBfx_dptbl.c\fR File Used for Building the New \fBfx_dptbl\fR
  242. .sp
  243. .LP
  244. The following is an example of a \fBfx_dptbl.c\fR file used for building the
  245. new \fBfx_dptbl\fR.
  246. .sp
  247. .in +2
  248. .nf
  249. /* BEGIN fx_dptbl.c */
  250. #include <sys/proc.h>
  251. #include <sys/priocntl.h>
  252. #include <sys/class.h>
  253. #include <sys/disp.h>
  254. #include <sys/fx.h>
  255. #include <sys/fxpriocntl.h>
  256. /*
  257. * This is the loadable module wrapper.
  258. */
  259. #include <sys/modctl.h>
  260. extern struct mod_ops mod_miscops;
  261. /*
  262. * Module linkage information for the kernel.
  263. */
  264. static struct modlmisc modlmisc = {
  265. &mod_miscops, "Fixed priority dispatch table"
  266. };
  267. static struct modlinkage modlinkage = {
  268. MODREV_1, &modlmisc, 0
  269. };
  270. _init()
  271. {
  272. return (mod_install(&modlinkage));
  273. }
  274. _info(modinfop)
  275. struct modinfo *modinfop;
  276. {
  277. return (mod_info(&modlinkage, modinfop));
  278. }
  279. #define FXGPUP0 0 /* Global priority for FX user priority 0 */
  280. fxdpent_t config_fx_dptbl[] = {
  281. /* glbpri qntm */
  282. FXGPUP0+0, 20,
  283. FXGPUP0+1, 20,
  284. FXGPUP0+2, 20,
  285. FXGPUP0+3, 20,
  286. FXGPUP0+4, 20,
  287. FXGPUP0+5, 20,
  288. FXGPUP0+6, 20,
  289. FXGPUP0+7, 20,
  290. FXGPUP0+8, 20,
  291. FXGPUP0+9, 20,
  292. FXGPUP0+10, 16,
  293. FXGPUP0+11, 16,
  294. FXGPUP0+12, 16,
  295. FXGPUP0+13, 16,
  296. FXGPUP0+14, 16,
  297. FXGPUP0+15, 16,
  298. FXGPUP0+16, 16,
  299. FXGPUP0+17, 16,
  300. FXGPUP0+18, 16,
  301. FXGPUP0+19, 16,
  302. FXGPUP0+20, 12,
  303. FXGPUP0+21, 12,
  304. FXGPUP0+22, 12,
  305. FXGPUP0+23, 12,
  306. FXGPUP0+24, 12,
  307. FXGPUP0+25, 12,
  308. FXGPUP0+26, 12,
  309. FXGPUP0+27, 12,
  310. FXGPUP0+28, 12,
  311. FXGPUP0+29, 12,
  312. FXGPUP0+30, 8,
  313. FXGPUP0+31, 8,
  314. FXGPUP0+32, 8,
  315. FXGPUP0+33, 8,
  316. FXGPUP0+34, 8,
  317. FXGPUP0+35, 8,
  318. FXGPUP0+36, 8,
  319. FXGPUP0+37, 8,
  320. FXGPUP0+38, 8,
  321. FXGPUP0+39, 8,
  322. FXGPUP0+40, 4,
  323. FXGPUP0+41, 4,
  324. FXGPUP0+42, 4,
  325. FXGPUP0+43, 4,
  326. FXGPUP0+44, 4,
  327. FXGPUP0+45, 4,
  328. FXGPUP0+46, 4,
  329. FXGPUP0+47, 4,
  330. FXGPUP0+48, 4,
  331. FXGPUP0+49, 4,
  332. FXGPUP0+50, 4,
  333. FXGPUP0+51, 4,
  334. FXGPUP0+52, 4,
  335. FXGPUP0+53, 4,
  336. FXGPUP0+54, 4,
  337. FXGPUP0+55, 4,
  338. FXGPUP0+56, 4,
  339. FXGPUP0+57, 4,
  340. FXGPUP0+58, 4,
  341. FXGPUP0+59, 2,
  342. FXGPUP0+60 2,
  343. };
  344. pri_t config_fx_maxumdpri =
  345. sizeof (config_fx_dptbl) / sizeof (fxdpent_t) - 1;
  346. /*
  347. * Return the address of config_fx_dptbl
  348. */
  349. fxdpent_t *
  350. fx_getdptbl()
  351. {
  352. return (config_fx_dptbl);
  353. }
  354. /*
  355. * Return the address of fx_maxumdpri
  356. */
  357. pri_t
  358. fx_getmaxumdpri()
  359. {
  360. /*
  361. * the config_fx_dptbl table.
  362. */
  363. return (config_fx_maxumdpri);
  364. }
  365. .fi
  366. .in -2
  367. .sp
  368. .SH SEE ALSO
  369. .sp
  370. .LP
  371. \fBpriocntl\fR(1), \fBdispadmin\fR(1M), \fBpriocntl\fR(2), \fBsystem\fR(4)
  372. .sp
  373. .LP
  374. \fISystem Administration Guide, Volume 1, System Interface Guide\fR
  375. .SH NOTES
  376. .sp
  377. .LP
  378. In order to improve performance under heavy system load, both the \fBnfsd\fR
  379. daemon and the \fBlockd\fR daemon utilize the maximum priority in the \fBFX\fR
  380. class. Unusual \fBfx_dptbl\fR configurations may have significant negative
  381. impact on the performance of the \fBnfsd\fR and \fBlockd\fR daemons.