All Products
Search
Document Center

Alibaba Cloud Linux:Enable the PSI feature for cgroup v1

Last Updated:Nov 20, 2024

In the Linux kernel, only the cgroup v2 interface supports the Pressure Stall Information (PSI) feature. Alibaba Cloud Linux 2 starting with kernel version 4.19.81-17.al7 and Alibaba Cloud Linux 3 support the PSI feature for the cgroup v1 interface to allow you to monitor the CPU, memory, I/O performance. This topic describes how to enable the PSI feature for the cgroup v1 interface and query relevant information.

Background information

PSI is a kernel feature that is used to monitor the CPU, memory, and I/O performance. For more information about the PSI feature, see the Documentation/accounting/psi.txt kernel document, which is included in the Debuginfo package and source code package of Alibaba Cloud Linux. For information about how to download the Debuginfo package and source code package, see Overview.

Enable the PSI feature for the cgroup v1 interface

By default, the PSI feature is disabled for the cgroup v1 interface. Perform the following steps to enable the PSI feature:

  1. Run the grubby command to modify the boot parameter.

    The default value of the args parameter is "psi=1", which indicates that the PSI feature is enabled for the cgroup v2 interface. Change the value of the parameter to "psi=1 psi_v1=1" to enable the PSI feature for the cgroup v1 interface. In this example, the kernel version 4.19.81-17.al7.x86_64 is used. Replace it with your actual kernel version. To query the kernel version, run the uname -a command.

    sudo grubby --update-kernel="/boot/vmlinuz-4.19.81-17.al7.x86_64" --args="psi=1 psi_v1=1"
  2. Restart the system to apply the change.

    sudo reboot

Check whether the PSI feature is enabled for the cgroup v1 interface

After the system restarts, you can run the following command to check whether the PSI feature is enabled for the cgroup v1 interface in /proc/cmdline of the kernel:

cat /proc/cmdline | grep "psi=1 psi_v1=1"

Query the monitoring data of the CPU, memory, and I/O performance

After the PSI feature is enabled for the cgroup v1 interface, the feature monitors the CPU, memory, and I/O performance and transmits all the monitoring data to the cpuacct controller. You can run the following commands to query detailed monitoring data:

cat /sys/fs/cgroup/cpuacct/cpu.pressure
cat /sys/fs/cgroup/cpuacct/memory.pressure
cat /sys/fs/cgroup/cpuacct/io.pressure