Locality-Optimized Resource Alignment
19
Table 4. Values for the numa_policy tunable parameter
Value
Default Memory Allocation Policy
Use Cases
0 automatically selected by the kernel at boot time recommended for all common workloads
and configurations
1 from the locality closest to the allocating processor in LORA mode or with lots of local
memory configured
2 from interleaved memory in SMP mode or with lots of interleaved
memory configured
3 text and library data segments from interleaved memory; others from
the locality closest to the allocating processor
highly threaded applications exhibiting
spatial locality
4 private objects from the closest locality; shared objects from
interleaved memory
applications that access lots of global
data
mpsched command
In LORA mode, the kernel attempts to provide good alignment between the processors executing an
application and the memory that they reference. To offer direct control over process placement, HP-
UX 11i provides the mpsched command. The command reveals information about localities in the
system and controls the processor or locality on which a specific process executes. The man page
has the full details on how to use the command.
The mpsched command can be used to bind processes to a particular locality. In the absence of this
binding, the operating system might schedule processes in different localities as the workload ebbs
and flows. The binding ensures that the processes are always executing in the same locality as the
memory they allocate and hence will experience low memory latency. The command can also be
used to specify a launch policy to control the scheduling of children forked by a process.
Using mpsched to enforce good alignment for Java
HP-UX is usually able to achieve good alignment when running Java. Here are some guidelines for
explicit tunes to enforce good alignment when running multiple instances of the Java virtual machine.
We'll assume that each Java instance is small enough in terms of processor and memory resources to
fit into a single locality. It is best to subdivide the Java instance if it exceeds the capacity of a single
locality.
Use the command mpsched –s to determine the number of localities in the partition and the locality
identifier corresponding to each locality. It is usually not necessary to use any launch policy if there
are fewer than three localities in the partition. If there are many localities, use commands similar to
the following to launch Java, distributing the Java virtual machines instances evenly across two
localities:
mpsched –l 2 java
mpsched –l 2 java
mpsched –l 3 java
mpsched –l 3 java
Since Java is highly threaded, it may be beneficial to set the numa_policy parameter to 3.