Code Monkey home page Code Monkey logo

oom_ext's Introduction

oom_ext

kernel module for OOM-state mitigation

The problem

OOM (out-of-memory) state is triggered under memory shortage conditions when kernel cannot free any additional memory pages to satisfy page request, and it is not likely that any pages will be reclaimed in the nearest time. Once in OOM state, a process is selected to be killed, alongside with a set of other processes sharing the same mm_struct. These processes will be sent TERM/KILL signals, while the other processes(threads) will be locked. Because of numerous drawbacks in the algorythm, it is a frequent situation that processes will never be able to exit, and machine would hang indefinitely until hard-rebooted.

Solution

When loaded, oom_ext reserves a portion of non-swappable memory as emergency buffer. Once OOM state is detected, the buffer is freed, effectively bringing the system out of OOM state an thus unlocking all the processes. The buffer doesn't need to be any huge, it just has to be large enough to win a few seconds of 'unlocked' operation for OOM-killer target processes to actually shut down.

Installation

Execute make inside code directory to build the module. After that, you will be able to try the module immediately with insmod oom_ext.ko. To install the module, execute make install. This will install the module under kernel modules directory, and it will be available for loading with modprobe oom_ext. Please note that installation will not set this module to autoload on boot: I prefer to leave autoloading (or not autoloading :) ) part to an end-user.

Configuration

The module adds a few sysctl's with which it can be configured:

Parameter Description Default
vm.oom_ext.gracetime time(sec) in OOM state before kernel panic (usable to reboot), 0 to disable panic 0
vm.oom_ext.resettime time(sec) out of OOM before recreating emergency buffer 300
vm.oom_ext.bufsize emergency buffer in MB, 0 to disable 32
vm.oom_ext.crashflag set crash flag file on fs, will be removed if oom ended, 0 to disable 1
vm.oom_ext.crashflag_name pathname for crash flag file /oomflag

oom_ext's People

Contributors

ivanfitenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

apptentive

oom_ext's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.