oom_badness(9)
okay bestie, welcome to oom_badness(9) from the Kernel API Manual β yes, the whole page is about one very specific OOM heuristic, and it is lowkey giving main character energy. π
β¨
π NAME π
oom_badness β the heuristic function that determines which candidate task to kill. No cap, that's the whole vibe. π«Ά
β¨ SYNOPSIS β¨
long oom_badness (struct task_struct *p , unsigned long totalpages );
πΈ ARGUMENTS πΈ
pβ thetask_structof which task we should calculate. Like, whose badness are we even computing, bestie? That's the task in question. πtotalpagesβ total present RAM allowed for page allocation. That's the memory ceiling in the mix. β¨
π DESCRIPTION π
okay so real talk: the heuristic for determining which task to kill is made to be as simple and predictable as possible. That's the whole design brief, and honestly? iconic. π
The goal is to return the highest value for the task consuming the most memory to avoid subsequent oom failures. So yeah β biggest memory goblin gets the highest value, and that's on purpose to dodge the next oom situation. π₯
π¦ SEE ALSO π¦
Kernel file ./mm/oom_kill.c is the source-y bestie, and then there's the whole friend group:
oom_cpuset_eligible(9)dump_tasks(9)mark_oom_victim(9)exit_oom_victim(9)oom_killer_enable(9)oom_killer_disable(9)out_of_memory(9)
shoutout to the source/version ./mm, the date October 2026, and oom_badness(9) β that's the footer, bestie, and that's a wrap πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms