Skip to content
A userspace out-of-memory killer
Branch: master
Clone or download
danobi and facebook-github-bot Add clang-format check to travis build steps (#53)
Summary:
This'll help people to remember to run `./clang-format`.
Pull Request resolved: #53

Differential Revision: D14549352

Pulled By: danobi

fbshipit-source-id: 464fa5a441ebed6212bca41203e1e3a7d57cb00e
Latest commit 7fecb55 Mar 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Make plugin arguments optional Mar 19, 2019
docs Make memory_reclaim operate on cgroups Mar 18, 2019
engine Evaluate all detectors and detector groups Feb 15, 2019
etc
fixtures
include Move ActionContext definition to OomdContext Feb 9, 2019
plugins Make memory_reclaim operate on cgroups Mar 18, 2019
util Return cleanly on errors instead of aborting (#43) Jan 17, 2019
.clang-format
.gitignore Use docker environment for latest Ubuntu on Travis (#48) Jan 30, 2019
.travis.yml
CODE_OF_CONDUCT.md Fix broken code of conduct link Jul 23, 2018
CONTRIBUTING.md Initial commit Jul 12, 2018
LICENSE
Log.cpp Return cleanly on errors instead of aborting (#43) Jan 17, 2019
Log.h
LogTest.cpp
Main.cpp
Oomd.cpp
Oomd.h
OomdContext.cpp
OomdContext.h Move ActionContext definition to OomdContext Feb 9, 2019
OomdContextTest.cpp Remove unused OomContext Jan 29, 2019
OomdTest.cpp Add command line option to specify cgroup2 filesystem mount point (#39) Jan 29, 2019
PluginRegistry.cpp
PluginRegistry.h Reimplement example plugin Dec 3, 2018
README.md Add meson build and docs for memory_above and systemd_restart plugins ( Dec 20, 2018
build-from-github.sh
clang-format.sh
meson.build

README.md

oomd

Build Status

oomd is userspace Out-Of-Memory (OOM) killer for linux systems.

Background

Out of memory killing has historically happened inside kernel space. On a memory overcommitted linux system, malloc(2) and friends usually never fail. However, if an application dereferences the returned pointer and the system has run out of physical memory, the linux kernel is forced take extreme measures, up to and including killing processes. This is sometimes a slow and painful process because the kernel can spend an unbounded amount of time swapping in and out pages and evicting the page cache. Furthermore, configuring policy is not very flexible while being somewhat complicated.

oomd aims to solve this problem in userspace. oomd leverages PSI and cgroupv2 to monitor a system holistically. oomd then takes corrective action in userspace before an OOM occurs in kernel space. Corrective action is configured via a flexible plugin system, in which custom code can be written. By default, this involves killing offending processes. This enables an unparalleled level of flexibility where each workload can have custom protection rules. Furthermore, time spent livedlocked in kernelspace is minimized. In practice at Facebook, we've regularly seen 30 minute host lockups go away entirely.

Building and installing

Note that oomd requires PSI to function. This kernel feature has been landed upstream and is staged for the 4.20 release.

oomd currently depends on meson and jsoncpp. libsystemd is an optional dependency.

$ git clone https://github.com/facebookincubator/oomd
$ cd oomd
$ meson build && ninja -C build
$ cd build && sudo ninja install

Configuration

See docs/configuration.md for a high level overview and some examples.

See docs/core_plugins.md for a quick reference on core plugin capabilities.

Running tests

oomd depends on gtest/gmock to run tests. Installing gtest/gmock from master is preferred.

If meson detects gtest/gmock is installed, meson will generate build rules for tests.

$ cd oomd
$ rm -rf build
$ meson build && ninja test -C build

Writing custom plugins

It is both possible and encouraged to write custom plugins. The codebase is designed to make writing plugins as easy as possible.

See docs/writing_a_plugin.md for a tutorial.

Help / Discussion / Support

Join our #oomd channel on irc.freenode.net!

License

oomd is GPL 2 licensed, as found in the LICENSE file.

You can’t perform that action at this time.