6591 resource_controls(5) should talk about project.cpu-cap not project.cpu-caps
[unleashed.git] / usr / src / man / man5 / resource_controls.5
blob6546af320d0e673cf8fd5aa7122dd89f16fe893c
1 '\" te
2 .\" Copyright (c) 2007, 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 RESOURCE_CONTROLS 5 "Jul 19, 2013"
7 .SH NAME
8 resource_controls \- resource controls available through project database
9 .SH DESCRIPTION
10 .LP
11 The resource controls facility is configured through the project database. See
12 \fBproject\fR(4). You can set and modify resource controls through the
13 following utilities:
14 .RS +4
15 .TP
16 .ie t \(bu
17 .el o
18 \fBprctl\fR(1)
19 .RE
20 .RS +4
21 .TP
22 .ie t \(bu
23 .el o
24 \fBprojadd\fR(1M)
25 .RE
26 .RS +4
27 .TP
28 .ie t \(bu
29 .el o
30 \fBprojmod\fR(1M)
31 .RE
32 .RS +4
33 .TP
34 .ie t \(bu
35 .el o
36 \fBrctladm\fR(1M)
37 .RE
38 .sp
39 .LP
40 In a program, you use \fBsetrctl\fR(2) to set resource control values.
41 .sp
42 .LP
43 In addition to the preceding resource controls, there are resource pools,
44 accessible through the \fBpooladm\fR(1M) and \fBpoolcfg\fR(1M) utilities. In a
45 program, resource pools can be manipulated through the \fBlibpool\fR(3LIB)
46 library.
47 .sp
48 .LP
49 The following are the resource controls are available:
50 .sp
51 .ne 2
52 .na
53 \fB\fBprocess.max-address-space\fR\fR
54 .ad
55 .sp .6
56 .RS 4n
57 Maximum amount of address space, as summed over segment sizes, that is
58 available to this process, expressed as a number of bytes.
59 .RE
61 .sp
62 .ne 2
63 .na
64 \fB\fBprocess.max-core-size\fR\fR
65 .ad
66 .sp .6
67 .RS 4n
68 Maximum size of a core file created by this process, expressed as a number of
69 bytes.
70 .RE
72 .sp
73 .ne 2
74 .na
75 \fB\fBprocess.max-cpu-time\fR\fR
76 .ad
77 .sp .6
78 .RS 4n
79 Maximum CPU time that is available to this process, expressed as a number of
80 seconds.
81 .RE
83 .sp
84 .ne 2
85 .na
86 \fB\fBprocess.max-data-size\fR\fR
87 .ad
88 .sp .6
89 .RS 4n
90 Maximum heap memory available to this process, expressed as a number of bytes.
91 .RE
93 .sp
94 .ne 2
95 .na
96 \fB\fBprocess.max-file-descriptor\fR\fR
97 .ad
98 .sp .6
99 .RS 4n
100 Maximum file descriptor index available to this process, expressed as an
101 integer.
105 .ne 2
107 \fB\fBprocess.max-file-size\fR\fR
109 .sp .6
110 .RS 4n
111 Maximum file offset available for writing by this process, expressed as a
112 number of bytes.
116 .ne 2
118 \fB\fBprocess.max-msg-messages\fR\fR
120 .sp .6
121 .RS 4n
122 Maximum number of messages on a message queue (value copied from the resource
123 control at \fBmsgget()\fR time), expressed as an integer.
127 .ne 2
129 \fB\fBprocess.max-msg-qbytes\fR\fR
131 .sp .6
132 .RS 4n
133 Maximum number of bytes of messages on a message queue (value copied from the
134 resource control at \fBmsgget()\fR time), expressed as a number of bytes.
138 .ne 2
140 \fB\fBprocess.max-port-events\fR\fR
142 .sp .6
143 .RS 4n
144 Maximum allowable number of events per event port, expressed as an integer.
148 .ne 2
150 \fB\fBprocess.max-sem-nsems\fR\fR
152 .sp .6
153 .RS 4n
154 Maximum number of semaphores allowed per semaphore set, expressed as an
155 integer.
159 .ne 2
161 \fB\fBprocess.max-sem-ops\fR\fR
163 .sp .6
164 .RS 4n
165 Maximum number of semaphore operations allowed per \fBsemop\fR call (value
166 copied from the resource control at \fBsemget()\fR time). Expressed as an
167 integer, specifying the number of operations.
171 .ne 2
173 \fB\fBprocess.max-sigqueue-size\fR\fR
175 .sp .6
176 .RS 4n
177 Maximum number of outstanding queued signals.
181 .ne 2
183 \fB\fBprocess.max-stack-size\fR\fR
185 .sp .6
186 .RS 4n
187 Maximum stack memory segment available to this process, expressed as a number
188 of bytes.
192 .ne 2
194 \fB\fBproject.cpu-cap\fR\fR
196 .sp .6
197 .RS 4n
198 Maximum amount of CPU resources that a project can use. The unit used is the
199 percentage of a single CPU that can be used by all user threads in a project.
200 Expressed as an integer. The cap does not apply to threads running in real-time
201 scheduling class. This resource control does not support the \fBsyslog\fR
202 action.
206 .ne 2
208 \fB\fBproject.cpu-shares\fR\fR
210 .sp .6
211 .RS 4n
212 Number of CPU shares granted to a project for use with the fair share scheduler
213 (see \fBFSS\fR(7)). The unit used is the number of shares (an integer). This
214 resource control does not support the \fBsyslog\fR action.
218 .ne 2
220 \fB\fBproject.max-contracts\fR\fR
222 .sp .6
223 .RS 4n
224 Maximum number of contracts allowed in a project, expressed as an integer.
228 .ne 2
230 \fB\fBproject.max-crypto-memory\fR\fR
232 .sp .6
233 .RS 4n
234 Maximum amount of kernel memory that can be used for crypto operations.
235 Allocations in the kernel for buffers and session-related structures are
236 charged against this resource control.
240 .ne 2
242 \fB\fBproject.max-locked-memory\fR\fR
244 .sp .6
245 .RS 4n
246 Total amount of physical memory locked by device drivers and user processes
247 (including D/ISM), expressed as a number of bytes.
251 .ne 2
253 \fB\fBproject.max-lwps\fR\fR
255 .sp .6
256 .RS 4n
257 Maximum number of LWPs simultaneously available to a project, expressed as an
258 integer.
262 .ne 2
264 \fB\fBproject.max-msg-ids\fR\fR
266 .sp .6
267 .RS 4n
268 Maximum number of message queue IDs allowed for a project, expressed as an
269 integer.
273 .ne 2
275 \fB\fBproject.max-port-ids\fR\fR
277 .sp .6
278 .RS 4n
279 Maximum allowable number of event ports, expressed as an integer.
283 .ne 2
285 \fB\fBproject.max-sem-ids\fR\fR
287 .sp .6
288 .RS 4n
289 Maximum number of semaphore IDs allowed for a project, expressed as an integer.
293 .ne 2
295 \fB\fBproject.max-shm-ids\fR\fR
297 .sp .6
298 .RS 4n
299 Maximum number of shared memory IDs allowed for a project, expressed as an
300 integer.
304 .ne 2
306 \fB\fBproject.max-shm-memory\fR\fR
308 .sp .6
309 .RS 4n
310 Total amount of shared memory allowed for a project, expressed as a number of
311 bytes.
315 .ne 2
317 \fB\fBproject.max-tasks\fR\fR
319 .sp .6
320 .RS 4n
321 Maximum number of tasks allowable in a project, expressed as an integer.
325 .ne 2
327 \fB\fBproject.pool\fR\fR
329 .sp .6
330 .RS 4n
331 Binds a specified resource pool with a project.
335 .ne 2
337 \fB\fBrcap.max-rss\fR\fR
339 .sp .6
340 .RS 4n
341 The total amount of physical memory, in bytes, that is available to processes
342 in a project.
346 .ne 2
348 \fB\fBtask.max-cpu-time\fR\fR
350 .sp .6
351 .RS 4n
352 Maximum CPU time that is available to this task's processes, expressed as a
353 number of seconds.
357 .ne 2
359 \fB\fBtask.max-lwps\fR\fR
361 .sp .6
362 .RS 4n
363 Maximum number of LWPs simultaneously available to this task's processes,
364 expressed as an integer.
369 The following zone-wide resource controls are available:
371 .ne 2
373 \fB\fBzone.cpu-cap\fR\fR
375 .sp .6
376 .RS 4n
377 Sets a limit on the amount of CPU time that can be used by a zone. The unit
378 used is the percentage of a single CPU that can be used by all user threads in
379 a zone. Expressed as an integer. When projects within the capped zone have
380 their own caps, the minimum value takes precedence. This resource control does
381 not support the \fBsyslog\fR action.
385 .ne 2
387 \fB\fBzone.cpu-shares\fR\fR
389 .sp .6
390 .RS 4n
391 Sets a limit on the number of fair share scheduler (FSS) CPU shares for a zone.
392 CPU shares are first allocated to the zone, and then further subdivided among
393 projects within the zone as specified in the \fBproject.cpu-shares\fR entries.
394 Expressed as an integer. This resource control does not support the
395 \fBsyslog\fR action.
399 .ne 2
401 \fB\fBzone.max-locked-memory\fR\fR
403 .sp .6
404 .RS 4n
405 Total amount of physical locked memory available to a zone.
409 .ne 2
411 \fB\fBzone.max-lwps\fR\fR
413 .sp .6
414 .RS 4n
415 Enhances resource isolation by preventing too many LWPs in one zone from
416 affecting other zones. A zone's total LWPs can be further subdivided among
417 projects within the zone within the zone by using \fBproject.max-lwps\fR
418 entries. Expressed as an integer.
422 .ne 2
424 \fB\fBzone.max-msg-ids\fR\fR
426 .sp .6
427 .RS 4n
428 Maximum number of message queue IDs allowed for a zone, expressed as an
429 integer.
433 .ne 2
435 \fB\fBzone.max-sem-ids\fR\fR
437 .sp .6
438 .RS 4n
439 Maximum number of semaphore IDs allowed for a zone, expressed as an integer.
443 .ne 2
445 \fB\fBzone.max-shm-ids\fR\fR
447 .sp .6
448 .RS 4n
449 Maximum number of shared memory IDs allowed for a zone, expressed as an
450 integer.
454 .ne 2
456 \fB\fBzone.max-shm-memory\fR\fR
458 .sp .6
459 .RS 4n
460 Total amount of shared memory allowed for a zone, expressed as a number of
461 bytes.
465 .ne 2
467 \fB\fBzone.max-swap\fR\fR
469 .sp .6
470 .RS 4n
471 Total amount of swap that can be consumed by user process address space
472 mappings and \fBtmpfs\fR mounts for this zone.
477 See \fBzones\fR(5).
478 .SS "Units Used in Resource Controls"
480 Resource controls can be expressed as in units of size (bytes), time (seconds),
481 or as a count (integer). These units use the strings specified below.
483 .in +2
485 Category             Res Ctrl      Modifier  Scale
486                      Type String
487 -----------          -----------   --------  -----
488 Size                 bytes         B         1
489                                    KB        2^10
490                                    MB        2^20
491                                    GB        2^30
492                                    TB        2^40
493                                    PB        2^50
494                                    EB        2^60
496 Time                 seconds       s         1
497                                    Ks        10^3
498                                    Ms        10^6
499                                    Gs        10^9
500                                    Ts        10^12
501                                    Ps        10^15
502                                    Es        10^18
504 Count                integer       none      1
505                                    K         10^3
506                                    M         10^6
507                                    G         10^9
508                                    T         10^12
509                                    P         10^15
510                                    Es        10^18
512 .in -2
516 Scaled values can be used with resource controls. The following example shows a
517 scaled threshold value:
519 .in +2
521 task.max-lwps=(priv,1K,deny)
523 .in -2
527 In the \fBproject\fR file, the value \fB1K\fR is expanded to \fB1000\fR:
529 .in +2
531 task.max-lwps=(priv,1000,deny)
533 .in -2
537 A second example uses a larger scaled value:
539 .in +2
541 process.max-file-size=(priv,5G,deny)
543 .in -2
547 In the \fBproject\fR file, the value \fB5G\fR is expanded to \fB5368709120\fR:
549 .in +2
551 process.max-file-size=(priv,5368709120,deny)
553 .in -2
557 The preceding examples use the scaling factors specified in the table above.
560 Note that unit modifiers (for example, \fB5G\fR) are accepted by the
561 \fBprctl\fR(1), \fBprojadd\fR(1M), and \fBprojmod\fR(1M) commands. You cannot
562 use unit modifiers in the project database itself.
563 .SS "Resource Control Values and Privilege Levels"
565 A threshold value on a resource control constitutes a point at which local
566 actions can be triggered or global actions, such as logging, can occur.
569 Each threshold value on a resource control must be associated with a privilege
570 level. The privilege level must be one of the following three types:
572 .ne 2
574 \fB\fBbasic\fR\fR
576 .sp .6
577 .RS 4n
578 Can be modified by the owner of the calling process.
582 .ne 2
584 \fB\fBprivileged\fR\fR
586 .sp .6
587 .RS 4n
588 Can be modified by the current process (requiring \fBsys_resource\fR privilege)
589 or by \fBprctl\fR(1) (requiring \fBproc_owner\fR privilege).
593 .ne 2
595 \fB\fBsystem\fR\fR
597 .sp .6
598 .RS 4n
599 Fixed for the duration of the operating system instance.
604 A resource control is guaranteed to have one \fBsystem\fR value, which is
605 defined by the system, or resource provider. The \fBsystem\fR value represents
606 how much of the resource the current implementation of the operating system is
607 capable of providing.
610 Any number of privileged values can be defined, and only one basic value is
611 allowed. Operations that are performed without specifying a privilege value are
612 assigned a basic privilege by default.
615 The privilege level for a resource control value is defined in the privilege
616 field of the resource control block as \fBRCTL_BASIC\fR, \fBRCTL_PRIVILEGED\fR,
617 or \fBRCTL_SYSTEM\fR. See \fBsetrctl\fR(2) for more information. You can use
618 the \fBprctl\fR command to modify values that are associated with basic and
619 privileged levels.
622 In specifying the privilege level of \fBprivileged\fR, you can use the
623 abbreviation \fBpriv\fR. For example:
625 .in +2
627 task.max-lwps=(priv,1K,deny)
629 .in -2
631 .SS "Global and Local Actions on Resource Control Values"
633 There are two categories of actions on resource control values: global and
634 local.
637 Global actions apply to resource control values for every resource control on
638 the system. You can use \fBrctladm\fR(1M) to perform the following actions:
639 .RS +4
641 .ie t \(bu
642 .el o
643 Display the global state of active system resource controls.
645 .RS +4
647 .ie t \(bu
648 .el o
649 Set global logging actions.
653 You can disable or enable the global logging action on resource controls. You
654 can set the \fBsyslog\fR action to a specific degree by assigning a severity
655 level, \fBsyslog=\fR\fIlevel\fR. The possible settings for \fIlevel\fR are as
656 follows:
657 .RS +4
659 .ie t \(bu
660 .el o
661 \fBdebug\fR
663 .RS +4
665 .ie t \(bu
666 .el o
667 \fBinfo\fR
669 .RS +4
671 .ie t \(bu
672 .el o
673 \fBnotice\fR
675 .RS +4
677 .ie t \(bu
678 .el o
679 \fBwarning\fR
681 .RS +4
683 .ie t \(bu
684 .el o
685 \fBerr\fR
687 .RS +4
689 .ie t \(bu
690 .el o
691 \fBcrit\fR
693 .RS +4
695 .ie t \(bu
696 .el o
697 \fBalert\fR
699 .RS +4
701 .ie t \(bu
702 .el o
703 \fBemerg\fR
707 By default, there is no global logging of resource control violations.
710 Local actions are taken on a process that attempts to exceed the control value.
711 For each threshold value that is placed on a resource control, you can
712 associate one or more actions. There are three types of local actions:
713 \fBnone\fR, \fBdeny\fR, and \fBsignal=\fR. These three actions are used as
714 follows:
716 .ne 2
718 \fB\fBnone\fR\fR
720 .sp .6
721 .RS 4n
722 No action is taken on resource requests for an amount that is greater than the
723 threshold. This action is useful for monitoring resource usage without
724 affecting the progress of applications. You can also enable a global message
725 that displays when the resource control is exceeded, while, at the same time,
726 the process exceeding the threshhold is not affected.
730 .ne 2
732 \fB\fBdeny\fR\fR
734 .sp .6
735 .RS 4n
736 You can deny resource requests for an amount that is greater than the
737 threshold. For example, a \fBtask.max-lwps\fR resource control with action deny
738 causes a \fBfork()\fR system call to fail if the new process would exceed the
739 control value. See the \fBfork\fR(2).
743 .ne 2
745 \fB\fBsignal=\fR\fR
747 .sp .6
748 .RS 4n
749 You can enable a global signal message action when the resource control is
750 exceeded. A signal is sent to the process when the threshold value is exceeded.
751 Additional signals are not sent if the process consumes additional resources.
752 Available signals are listed below.
757 Not all of the actions can be applied to every resource control. For example, a
758 process cannot exceed the number of CPU shares assigned to the project of which
759 it is a member. Therefore, a deny action is not allowed on the
760 \fBproject.cpu-shares\fR resource control.
763 Due to implementation restrictions, the global properties of each control can
764 restrict the range of available actions that can be set on the threshold value.
765 (See \fBrctladm\fR(1M).) A list of available signal actions is presented in the
766 following list. For additional information about signals, see
767 \fBsignal\fR(3HEAD).
770 The following are the signals available to resource control values:
772 .ne 2
774 \fB\fBSIGABRT\fR\fR
776 .sp .6
777 .RS 4n
778 Terminate the process.
782 .ne 2
784 \fB\fBSIGHUP\fR\fR
786 .sp .6
787 .RS 4n
788 Send a hangup signal. Occurs when carrier drops on an open line. Signal sent to
789 the process group that controls the terminal.
793 .ne 2
795 \fB\fBSIGTERM\fR\fR
797 .sp .6
798 .RS 4n
799 Terminate the process. Termination signal sent by software.
803 .ne 2
805 \fB\fBSIGKILL\fR\fR
807 .sp .6
808 .RS 4n
809 Terminate the process and kill the program.
813 .ne 2
815 \fB\fBSIGSTOP\fR\fR
817 .sp .6
818 .RS 4n
819 Stop the process. Job control signal.
823 .ne 2
825 \fB\fBSIGXRES\fR\fR
827 .sp .6
828 .RS 4n
829 Resource control limit exceeded. Generated by resource control facility.
833 .ne 2
835 \fB\fBSIGXFSZ\fR\fR
837 .sp .6
838 .RS 4n
839 Terminate the process. File size limit exceeded. Available only to resource
840 controls with the \fBRCTL_GLOBAL_FILE_SIZE\fR property
841 (\fBprocess.max-file-size\fR). See \fBrctlblk_set_value\fR(3C).
845 .ne 2
847 \fB\fBSIGXCPU\fR\fR
849 .sp .6
850 .RS 4n
851 Terminate the process. CPU time limit exceeded. Available only to resource
852 controls with the \fBRCTL_GLOBAL_CPUTIME\fR property
853 (\fBprocess.max-cpu-time\fR). See \fBrctlblk_set_value\fR(3C).
856 .SS "Resource Control Flags and Properties"
858 Each resource control on the system has a certain set of associated properties.
859 This set of properties is defined as a set of flags, which are associated with
860 all controlled instances of that resource. Global flags cannot be modified, but
861 the flags can be retrieved by using either \fBrctladm\fR(1M) or the
862 \fBsetrctl\fR(2) system call.
865 Local flags define the default behavior and configuration for a specific
866 threshold value of that resource control on a specific process or process
867 collective. The local flags for one threshold value do not affect the behavior
868 of other defined threshold values for the same resource control. However, the
869 global flags affect the behavior for every value associated with a particular
870 control. Local flags can be modified, within the constraints supplied by their
871 corresponding global flags, by the \fBprctl\fR command or the \fBsetrctl\fR
872 system call. See \fBsetrctl\fR(2).
875 For the complete list of local flags, global flags, and their definitions, see
876 \fBrctlblk_set_value\fR(3C).
879 To determine system behavior when a threshold value for a particular resource
880 control is reached, use \fBrctladm\fR to display the global flags for the
881 resource control . For example, to display the values for
882 \fBprocess.max-cpu-time\fR, enter:
884 .in +2
886 $ rctladm process.max-cpu-time
887 process.max-cpu-time  syslog=off [ lowerable no-deny cpu-time inf seconds ]
889 .in -2
893 The global flags indicate the following:
895 .ne 2
897 \fB\fBlowerable\fR\fR
899 .sp .6
900 .RS 4n
901 Superuser privileges are not required to lower the privileged values for this
902 control.
906 .ne 2
908 \fB\fBno-deny\fR\fR
910 .sp .6
911 .RS 4n
912 Even when threshold values are exceeded, access to the resource is never
913 denied.
917 .ne 2
919 \fB\fBcpu-time\fR\fR
921 .sp .6
922 .RS 4n
923 \fBSIGXCPU\fR is available to be sent when threshold values of this resource
924 are reached.
928 .ne 2
930 \fB\fBseconds\fR\fR
932 .sp .6
933 .RS 4n
934 The time value for the resource control.
939 Use the \fBprctl\fR command to display local values and actions for the
940 resource control. For example:
942 .in +2
944 $ prctl -n process.max-cpu-time $$
945     process 353939: -ksh
946     NAME    PRIVILEGE    VALUE    FLAG   ACTION              RECIPIENT
947  process.max-cpu-time
948          privileged   18.4Es    inf   signal=XCPU                 -
949          system       18.4Es    inf   none
951 .in -2
955 The \fBmax\fR (\fBRCTL_LOCAL_MAXIMAL\fR) flag is set for both threshold values,
956 and the \fBinf\fR (\fBRCTL_GLOBAL_INFINITE\fR) flag is defined for this
957 resource control. An \fBinf\fR value has an infinite quantity. The value is
958 never enforced. Hence, as configured, both threshold quantities represent
959 infinite values that are never exceeded.
960 .SS "Resource Control Enforcement"
962 More than one resource control can exist on a resource. A resource control can
963 exist at each containment level in the process model. If resource controls are
964 active on the same resource at different container levels, the smallest
965 container's control is enforced first. Thus, action is taken on
966 \fBprocess.max-cpu-time\fR before \fBtask.max-cpu-time\fR if both controls are
967 encountered simultaneously.
968 .SH ATTRIBUTES
970 See \fBattributes\fR(5) for a description of the following attributes:
975 box;
976 c | c
977 l | l .
978 ATTRIBUTE TYPE  ATTRIBUTE VALUE
980 Interface Stability     Evolving
983 .SH SEE ALSO
985 \fBprctl\fR(1), \fBpooladm\fR(1M), \fBpoolcfg\fR(1M), \fBprojadd\fR(1M),
986 \fBprojmod\fR(1M), \fBrctladm\fR(1M), \fBsetrctl\fR(2),
987 \fBrctlblk_set_value\fR(3C), \fBlibpool\fR(3LIB), \fBproject\fR(4),
988 \fBattributes\fR(5), \fBFSS\fR(7)
991 \fISystem Administration Guide:  Virtualization Using the Solaris Operating
992 System\fR