Knowledgebase

Can OOM killer be disabled in RHEL8-based kernels?

Disabling the Out Of Memory (OOM) killer is generally not recommended, as it serves as a last-resort mechanism to prevent system crashes due to memory exhaustion. However, in certain scenarios, you may have specific requirements where you want to disable the OOM killer. Keep in mind that doing so can potentially lead to system instability if memory resources are not managed carefully.

To disable the OOM killer in a RHEL 8-based kernel, you can try the following steps:

  1. Edit the Kernel Command Line:

    You can pass kernel parameters to disable the OOM killer during boot by editing the GRUB configuration.

    Open the GRUB configuration file:

    bash
sudo vi /etc/default/grub

Find the GRUB_CMDLINE_LINUX parameter and add oom_score_adj=-1000:

bash

 

  • GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet oom_score_adj=-1000"

    Save the file and exit the editor.

  • Update GRUB Configuration:

    After editing the GRUB configuration, you'll need to update GRUB:

    bash
  • sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  • Reboot:

    Reboot the system for the changes to take effect:

    bash

 

  1. sudo reboot

Again, it's important to emphasize that disabling the OOM killer can have serious consequences if not managed properly. It's typically better to address memory issues by adjusting system configurations, adding more RAM, or optimizing processes to use memory more efficiently.

If you're considering disabling the OOM killer, it's recommended to thoroughly understand the potential risks and consult with experienced system administrators or engineers to ensure that it's the appropriate course of action for your specific use case.

 
  • 0 Users Found This Useful
Was this answer helpful?