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.
Getting Information About Tunables |
 |
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:
# kctune acctresume maxuprc nproc
Tunable Value Expression Changes
acctresume 4 Default
maxuprc 256 Default Immed
nproc 4200 Default Immed |
With the -d Option The -d option adds the description
of each tunable:
# kctune -d acctresume maxuprc nproc
Tunable Value Expression Changes
Description
acctresume 4 Default
Relative percentage of free disk space required to resume accounting
maxuprc 256 Default Immed
Maximum number of processes for each non-root user
nproc 4200 Default Immed
Maximum number of processes on the system |
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.
# kctune -g acctresume maxuprc nproc
Module Tunable Value Expression Changes
pm_acct acctresume 4 Default
pm_proc maxuprc 256 Default Immed
pm_proc nproc 4200 Default Immed |
With the -v Option The -v option gives verbose,
multiline information about each tunable:
 |
# kctune -v acctresume maxuprc nproc
Tunable acctresume
Description Relative percentage of free disk space required to resume accounting
Module pm_acct
Current Value 4 [Default]
Value at Next Boot 4 [Default]
Value at Last Boot 4
Default Value 4
Constraints acctresume >= -100
acctresume <= 101
acctresume > acctsuspend
Can Change At Next Boot Only
Tunable maxuprc
Description Maximum number of processes for each non-root user
Module pm_proc
Current Value 256 [Default]
Value at Next Boot 256 [Default]
Value at Last Boot 256
Default Value 256
Constraints maxuprc >= 3
maxuprc <= nproc - 5
Can Change Immediately or at Next Boot
Tunable nproc
Description Maximum number of processes on the system
Module pm_proc
Current Value 4200 [Default]
Value at Next Boot 4200 [Default]
Value at Last Boot 4200
Default Value 4200
Constraints nproc >= 100
nproc <= 131072
nproc >= semmnu + 4
nproc >= maxuprc + 5
nproc <= nkthread - 100
Can Change Immediately or at Next Boot |
 |
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.
# kctune -P ALL nproc
name nproc
module pm_proc
desc Maximum number of processes on the system
defvalue 4200
bootvalue 4200
current 4200
next_boot 4200
expr Default
next_expr Default
min 100
max 131072
dynamic y
canauto n
default y
auto_default n
next_default y
signed n
flags 0x6c3
constraint nproc >= 100
constraint nproc <= 131072
constraint nproc >= semmnu + 4
constraint nproc >= maxuprc + 5
constraint nproc <= nkthread - 100 |
Use a comma-separated list with the -P option to display the categories you want.
# kctune -P name,current maxuprc nproc
name maxuprc
current 256
name nproc
current 4200
|
Interpreting Tunable Information |
 |
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.
 |
 |  |
 |
 | NOTE: Setting a tunable to Default is not the same thing as setting it explicitly to the default value
reported by kctune. Using the example above, if
you set nproc to 4200, its value
will remain 4200 until you change it. However,
if you set nproc to Default,
its value will be kept up to date with any changes HP makes to the
default value for nproc. |
 |
 |  |
 |
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.
Changing Tunable Values |
 |
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.)
# kctune nproc=
# kctune nproc=Default |
Assignments can use expressions, as noted above.
Note that the assignment may need to be quoted to avoid interpretation
by the shell.
# kctune 'nkthread=nproc*2+100' |
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.