Examining the CPU topology

Red Hat Enterprise Linux 8.6 LPAR mode

If supported by your hardware, an interface is available that you can use to get information about the CPU topology of an LPAR.

Before you begin

Meaningful CPU topology information is available only to Linux® in LPAR mode.

About this task

Use this information, for example, to optimize the Linux scheduler, which bases its decisions on which process gets scheduled to which CPU. Depending on the workload, this optimization might increase cache hits and therefore overall performance.

Note: By default CPU topology support is enabled in the Linux kernel. If it is not suitable for your workload, disable the support by specifying the kernel parameter topology=off in your parmfile or zipl.conf.
The following sysfs attributes provide information about the CPU topology:

/sys/devices/system/cpu/cpu<N>/topology/thread_siblings
/sys/devices/system/cpu/cpu<N>/topology/core_siblings
/sys/devices/system/cpu/cpu<N>/topology/book_siblings
/sys/devices/system/cpu/cpu<N>/topology/drawer_siblings
where <N> specifies a particular logical CPU number. These attributes contain masks that specify sets of CPUs.

Because the mainframe hardware is evolving over time, the terms drawer, book, core, and thread do not necessarily correspond to fixed hardware entities. What matters for the Linux scheduler is the levels of relatedness that these terms signify, not the physical embodiment of the levels. In this context, more closely related means sharing more resources, like caches.

The thread_siblings, core_siblings, book_siblings, and drawer_siblings attribute each contain a mask that specifies the CPU and its peers at a particular level of relatedness.

  1. The thread_siblings attribute covers the CPU and its closely related peers.
  2. The core_siblings attribute covers all CPUs of the thread_siblings attribute and peers related at the core level.
  3. The book_siblings attribute covers all CPUs of the core_siblings attribute and peers related at the book level.
  4. The drawer_siblings attribute covers all CPUs of the book_siblings attribute and peers related at the drawer level.

If a machine reconfiguration causes the CPU topology to change, change uevents are created for each online CPU.

If the kernel also supports standby CPU activation and deactivation, the masks also contains the CPUs that are in a configured, but offline state. Updating the masks after a reconfiguration might take some time.