Help Center/ Huawei Cloud EulerOS/ FAQs/ How Do I Understand the Value of panic_on_oom?
Updated on 2025-09-04 GMT+08:00

How Do I Understand the Value of panic_on_oom?

Description

panic_on_oom controls how the system reacts when OOM occurs. When OOM occurs, the system has two choices:

  • Trigger a kernel panic, during which the system may break down frequently.
  • Trigger OOM killer to terminate certain processes and release the memory so that the system can be used normally.

You can run either of the following commands to view the parameter value:

cat /proc/sys/vm/panic_on_oom

sysctl -a | grep panic_on_oom

  • If the value is set to 0, OOM killer is triggered when the memory is insufficient.
  • If the value is set to 1, either OOM killer or kernel panic will be triggered.
  • If the value is set to 2, a kernel panic will be forcibly triggered. As a result, the system restarts.

Change Description

In HCE 2.0.2503 or earlier versions, the default value of panic_on_oom is 1. In versions later than HCE 2.0.2503, the default value of panic_on_oom is 0.

After an upgrade to HCE 2.0.2503 and then a rollback to the previous version, the default value of panic_on_oom is still 0. If you need to change the value after a rollback, perform the following operations:

  • Temporary configuration: The configuration takes effect immediately. However, after the system is restarted, the value changes to the default one.
    For example, to set panic_on_oom to 1, run the following command:
    sysctl -w vm.panic_on_oom=1
  • Persistent configuration: The configuration still takes effect after the system is restarted.
    For example, to set panic_on_oom to 1, run the following command:
    vim /etc/sysctl.conf

    Add vm.panic_on_oom = 1 to the file, and then run sysctl -p or restart the system to make the configuration persistent.