Skip to content

Commit

Permalink
changed calculations of percents due to -M argument to use new User…
Browse files Browse the repository at this point in the history
…MemTotalKiB instead of MemTotalKiB
  • Loading branch information
mars4science committed Jan 20, 2024
1 parent 90f1a67 commit fb22678
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MANPAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If there is a failure when trying to kill a process, **earlyoom** sleeps for
# OPTIONS

#### -m PERCENT[,KILL_PERCENT]
set available memory minimum to PERCENT of total (default 10 %).
set available memory minimum to PERCENT of MemAvailable+AnonPages (as reported in **/proc/meminfo**) at the time of initialization (default 10 %).

earlyoom starts sending SIGTERM once **both** memory **and** swap are below their
respective PERCENT setting. It sends SIGKILL once **both** are below their respective
Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ int main(int argc, char* argv[])
}
// Merge "-M" with "-m" values
if (have_M) {
double M_term_percent = 100 * mem_term_kib / (double)m.MemTotalKiB;
double M_kill_percent = 100 * mem_kill_kib / (double)m.MemTotalKiB;
double M_term_percent = 100 * mem_term_kib / (double)m.UserMemTotalKiB;
double M_kill_percent = 100 * mem_kill_kib / (double)m.UserMemTotalKiB;
if (have_m) {
// Both -m and -M were passed. Use the lower of both values.
args.mem_term_percent = min(args.mem_term_percent, M_term_percent);
Expand Down

0 comments on commit fb22678

Please sign in to comment.