proc_pid_oom_score_adj(5)

๐ŸŒธ proc_pid_oom_score_adj โ€” the oom_score_adj file, bestie edition ๐ŸŒธ

okay so this is a page from section 5 of the Linux man-pages โ€” <rainbow>proc_pid_oom_score_adj(5)</rainbow>, aka the File Formats Manual โ€” and it's all about that one little procfile that decides who gets ๐Ÿ’€'d when your RAM runs out. sit down, hydrate, let's go.


โœจ NAME โœจ

/proc/pid/oom_score_adj โ€” OOM-killer score adjustment ๐Ÿ’…


๐Ÿซถ DESCRIPTION ๐Ÿซถ

/proc/pid/oom_score_adj</p> (since Linux 2.6.36)

This file is your lil' dial for tuning the badness heuristic โ€” the thing the kernel uses to pick which process gets murdered when you run out of memory. out-of-memory conditions, killed process, you know the vibe ๐Ÿ˜ญ

So the badness heuristic gives every candidate task a value from 0 (never kill) all the way up to 1000 (always kill), and that's how it decides who's the target. The units are roughly a proportion along that range of allowed memory the process may allocate from, based on an estimation of its current memory and swap use. like, if a task is using all of its allowed memory, its badness score is 1000. Using half of its allowed memory? Score is 500. simple math, slay โœจ

There's also an extra lil' factor baked into the badness score: root processes get 3% extra memory over other tasks. nepotism, honestly ๐Ÿ™ˆ

The amount of "allowed" memory depends on the context in which the OOM-killer was called:

  • if it's because the memory assigned to the allocating task's cpuset is exhausted, the allowed memory represents the set of mems assigned to that cpuset (see cpuset(7)) ๐ŸŽ€
  • if it's because a mempolicy's node(s) are exhausted, the allowed memory represents the set of mempolicy nodes
  • if it's because a memory limit (or swap limit) was reached, the allowed memory is that configured limit
  • and finally, if it's because the entire system is out of memory, the allowed memory represents all allocatable resources ๐ŸŒˆ

The value of oom_score_adj gets added to the badness score before it's used to figure out which task to kill. Acceptable values range from -1000 (OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX). This is how user space gets to control the preference for OOM-killing, ranging from always preferring a certain task all the way to completely disabling it from OOM-killing. And the lowest possible value, -1000, is basically equivalent to disabling OOM-killing entirely for that task, since it will always report a badness score of 0. it's giving "protected by the universe" energy ๐Ÿ‘‘

Consequently, it is very simple for user space to define the amount of memory to consider for each task. Setting an oom_score_adj value of +500, for example, is roughly equivalent to allowing the remainder of tasks sharing the same system, cpuset, mempolicy, or memory controller resources to use at least 50% more memory. A value of -500, on the other hand, would be roughly equivalent to discounting 50% of the task's allowed memory from being considered as scoring against the task. maths girlies rise ๐Ÿงš

For backward compatibility with previous kernels, /proc/pid/oom_adj can still be used to tune the badness score โ€” its value is scaled linearly with oom_score_adj ๐Ÿฆ‹

Writing to /proc/pid/oom_score_adj or /proc/pid/oom_adj will change the other with its scaled value. they're linked, they're a package deal, no cap ๐Ÿ’–

Also!! The choom(1) program provides a command-line interface for adjusting the oom_score_adj value of a running process or a newly executed command. use it, it's iconic.


๐Ÿ’œ HISTORY ๐Ÿ’œ

/proc/pid/oom_adj (since Linux 2.6.11)

This file can be used to adjust the score used to select which process should be killed in an out-of-memory (OOM) situation. The kernel uses this value for a bit-shift operation of the process's oom_score value: valid values are in the range -16 to +15, plus the special value -17, which disables OOM-killing altogether for this process. A positive score increases the likelihood of this process being killed by the OOM-killer; a negative score decreases it. ๐Ÿ’…

The default value for this file is 0; a new process inherits its parent's oom_adj setting. A process must be privileged (CAP_SYS_RESOURCE) to update this file, although a process can always increase its own oom_adj setting (since Linux 2.6.20). glow-up privileges, iykyk โœจ

Since Linux 2.6.36, use of this file is deprecated in favor of /proc/pid/oom_score_adj, and it was finally removed in Linux 3.7.

โš ๏ธ bestie listen: deprecated means deprecated, and removed means gone. don't be out here writing to /proc/pid/oom_adj on a modern kernel and acting surprised. ๐Ÿ’€

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€


okayyy that's the whole page, you understood all of it, I'm so proud ๐Ÿฅน go forth and tune your badness scores responsibly, mwah ๐Ÿ’…

this lil' rewrite was based on Linux man-pages 6.20, dated 2026-02-08 โ€” that's the source and the version, and also the date, all in one cute sign-off. bye bestie ๐ŸŽ€๐ŸŒธโœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: GPL-3.0-or-later
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms