bustd: Available memory or bust!
bustd is a lightweight process killer daemon for out-of-memory scenarios for Linux!
Small memory usage!
bustd seems to use less memory than some other lean daemons such as
¹: RSS stands for resident set size and represents the portion of RAM occupied by a process.
²: Compared when bustd was in this commit and earlyoom in this one.
bustd compiled with musl libc and earlyoom with glibc through GCC 11.1. Different configurations would likely change these figures.
Small CPU usage
bustd uses adaptive sleep times during its memory polling. Unlike these two, however,
bustd does not read from
/proc/meminfo, instead opting for the
This approach has its up- and downsides. The amount of free RAM that
sysinfo reads does not account for cached memory, while
sysinfo syscall is one order of magnitude faster, at least according to this kernel patch (granted, from 2015).
bustd can't solely rely on the free RAM readings of
sysinfo, we check for memory stress through Pressure Stall Information.
bustd will try to lock all pages mapped into its address space
mlockall to avoid being sent to swap, which allows the daemon to remain responsive even when the system memory is under heavy load and susceptible to thrashing.
Checks for Pressure Stall Information
The Linux kernel, since version 4.20 (and built with
CONFIG_PSI=y), presents canonical new pressure metrics for memory, CPU, and IO.
In the words of Facebook Incubator:
bustd checks for how long, in microseconds, processes have stalled in the last 10 seconds. By default,
bustd will kill a process when processes have stalled for 25 microseconds in the last ten seconds.
- Rust toolchain
- Any C compiler
- Linux 4.20+ built with
-n, --no-daemon flag is useful for running
bustd through an init system such as
Binaries are generated at every commit through GitHub Actions
- Allow for customization of the critical scenario (PSI cutoff)
- Command-line argument for disabling daemonization (useful for runnning
bustdas a systemd service)
- Command-line argument to enable killing the entire process group, not just the chosen process itself
- Allow the user to setup a list of software that
bustdshould never kill
- Notification sending and general notification customization settings