United States-English |
|
|
HP-UX System Administrator's Guide: Configuration Management: HP-UX 11i Version 3 > Chapter 10 Configuring the KernelManaging Kernel Tunable Parameters with kctune |
|
The kctune command is used to query and change the values of kernel tunable parameters (“tunables”), in the currently running configuration or in a saved configuration. Tunables are variables that govern the behavior of the HP-UX kernel. Tunables are used for a variety of different tasks: some control resource allocations; others control security policies; others enable optional kernel behavior; etc. There are 150-200 tunables in a typical kernel. See the kctune(1M) manpage. System administrators can create their own “user-defined” tunables if they choose. These will not affect the operation of the system directly, but they can be used in computing the values of other tunables. For example, an administrator could choose to create a num_databases tunable, and then set several kernel tunables based on its value. A subsequent change to the value of num_databases would cause all of the related kernel tunable values to be changed as well. When you run kctune with no options, it shows you the tunables associated with the kernel modules on your system (as well as any user-defined tunables), their current values, and the expressions used to compute those values. If there are changes to those values being held for next boot, those will be shown as well. On a typical system, the expression for most tunables is Default, meaning that the administrator is allowing the system to choose the tunable value. When you use the -c (configuration) option, kctune displays the tunable information from a saved configuration instead of the currently running system. The output of kctune can be varied with several options. To control which tunables are listed, use the -D (differences) or -S (set) option. The -D option restricts the output to only those tunables whose value at next boot is different from their current value. The -S option restricts the output to only those tunables that are set to a nondefault value. The output can also be restricted by listing tunable names on the command line. To control the output format, use the -d (description), -g (group), -v (verbose), or -P (parse) option. With No Options With no options, the output looks like this:
With the -d Option The -d option adds the description of each tunable:
With the -g Option The -g option adds the name of the module defining the tunable, and sorts the output by module name. This has the effect of grouping related tunables together in the output.
With the -v Option The -v option gives verbose, multiline information about each tunable:
With the -P Option The -P option, which is designed for use by scripts or programs, gives you complete control over what information is printed. For more information, see “Parsing Command Output” or the kconfig(5) manpage. The special keyword ALL displays all the possible categories. Compare with the -v option.
Use a comma-separated list with the -P option to display the categories you want.
Looking at the sample output above, you can see that each tunable has a name and a textual description. Each tunable is associated with a kernel module whose name is listed in the verbose output (or in the table output if -g is specified). Tunables can be seen and changed only if they are associated with a module that is installed on the system (or are user-defined). The module does not have to be in use. When displaying tunable information for the currently running system, kctune includes the current tunable value and the expression used to compute it. If changes to the tunable’s value are being held for next boot, the next boot value and expression are also shown. Verbose listings also show the value the tunable had when the system was last booted. When displaying tunable information for a saved configuration, kctune displays only a current value. Tunable values are computed integer expressions, which can refer to other tunable values. (Circular references are not permitted.) The value of a tunable could be 4200, or 0x400, or 12*1024, or 4*nproc+20. Values and expressions use the syntax of the C programming language. Therefore, numbers can be written in decimal (256), octal (01000), or hexadecimal (0x100). Expressions can use the following operators and symbols: ( ) ~ ! - + * / % << >> < <= > >= & ^ | == != && || ?: A few tunables also support values specified as percentages, for example, 10%. White space is not permitted in any tunable expression. For backward compatibility, tunable names used in expressions can appear in all capitals, but this usage is discouraged and support for it will be removed in a future release. All kernel tunables have a default value, which is chosen by the developer, and is shown in the verbose output. For some tunables, the default value is fixed and never changes. For other tunables, a new default value is chosen by the system at boot time. Still others can be automatically tuned, which means that the default value can change periodically while the system is running, in response to changing system resources and needs. When a tunable is set to default, its expression is reported as Default, as seen in the examples above. In these cases, the system is free to choose the value it thinks optimal, and to change it as needed. HP recommends that tunables be left set to default unless the default is known to be unsatisfactory. Some tunables have constraints on their values, which are shown in the verbose output. Sometimes these are minimum and/or maximum values, as shown for nproc above. Other times these are fixed relationships between tunables (for example, acctresume must be greater than acctsuspend) or restrictions on the allowed values (for example, dnlc_hash_locks must be a power of two). These constraints are enforced whenever tunable values are changed. There are other constraints, not shown by kctune, that are based on the current state of the system and can change over time (for example, nproc cannot be set to less than the number of processes currently running). These constraints are enforced only when changing the currently running system, and not when making changes held for use at next boot or changes to a saved configuration. Some tunables have restrictions on when their values can be changed. These restrictions are noted in the kctune output. Tunables whose values can be changed immediately are marked Immed. Tunables whose values can be automatically tuned by the system are marked Auto. Tunables without either marking can only be changed with a reboot. All HP-UX tunables have manpages. To obtain information about the behavior, allowed values, and side effects of a tunable, consult the manpage for that tunable, which can be found in section 5 of the online document. An overview of the kernel tunables can be found in Tunable Kernel Parameters, available on http://docs.hp.com. To change the value of a tunable, put tunable value assignments on the kctune command line. (Or see “Managing Configurations with System Files”.) For example, to set nproc to 4300:
To set a tunable to Default, either of these assignments will work. (Setting a user-defined tunable to Default causes it to be removed.)
Assignments can use expressions, as noted above. Note that the assignment may need to be quoted to avoid interpretation by the shell.
To create a user-defined tunable, use the -u (user-defined) option when you assign the tunable a value. The -u option is not needed to change the value of an existing user-defined tunable. Using the += symbol, you can increase the value of a tunable (by 100, in this example):
Using the >= symbol, you can ensure a minimum value of a tunable. The command:
will set nproc to 5000 if its current value is below 5000. If its current value is already 5000 or greater, it will be left unchanged. Note that the assignment is quoted to avoid interpretation by the shell. See the kctune(1M) manpage for details. When you change a tunable value using a command as in the above examples, the change will be made immediately to the currently running system, if possible. Sometimes it’s not possible to make the change immediately; for example, you might be trying to reduce the maximum value of some resource to below the current usage. Also, there are some tunables that cannot be changed without a reboot. In those cases, kctune will hold the change and apply it at next boot. If any change on the kctune command line has to be held for next boot, they all will be. Sometimes you may want to force a change to be held for next boot, instead of applying it immediately. In these cases you can use the -h (hold) option of kctune to force that behavior. HP recommends that this option be used only when the next boot is expected to be soon. If, for example, the next boot doesn’t happen for months after making such a change, the system administrator could be unpleasantly surprised at the effect of a pending change that had been forgotten. Changes to saved kernel configurations can be made by using the -c (configuration) option. Such changes are made to the saved configuration immediately, but they won’t affect the running system until that saved configuration is either loaded or booted. See “Managing Saved Configurations with kconfig” for more information. When changing tunable values, kctune supports the -b (backup) option to specify backup behavior, and the -C option to specify a log file comment. See “Recovering from Errors” and “The Kernel Configuration Log File” for details. |
Printable version | ||
|