From: "Lorenzo Stoakes (Oracle)" <ljs@kernel.org>
To: Kit Dallege <xaum.io@gmail.com>
Cc: akpm@linux-foundation.org, david@kernel.org, corbet@lwn.net,
linux-mm@kvack.org, linux-doc@vger.kernel.org,
Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] Docs/mm: document the OOM killer
Date: Sun, 15 Mar 2026 20:48:22 +0000 [thread overview]
Message-ID: <fbee0ca1-4de6-4182-865b-a33d9ed32ee4@lucifer.local> (raw)
In-Reply-To: <20260314152518.100194-1-xaum.io@gmail.com>
NAK for being AI slop again, obviously.
Again, +cc the OOM maintainer you failed to bother to look up.
Reasons, as the rest:
- Worthless documentation
- Everything about patch screams 'zero effort, Claude did it all'
- Bad etiquette
As with all the rest it'd need to be totally rewritten and it's not worth the
maintainer time.
On Sat, Mar 14, 2026 at 04:25:18PM +0100, Kit Dallege wrote:
> Fill in the oom.rst stub that was created in commit 481cc97349d6
> ("mm,doc: Add new documentation structure") as part of the structured
> memory management documentation following Mel Gorman's book outline.
I mean the more I see it the more annoying it is.
>
> Cover the scoring heuristic, allocation constraints, OOM reaper,
> process_mrelease syscall, and sysctl knobs.
This sentence contains almost as much content as the patch.
>
> Signed-off-by: Kit Dallege <xaum.io@gmail.com>
> ---
> Documentation/mm/oom.rst | 67 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 67 insertions(+)
>
> diff --git a/Documentation/mm/oom.rst b/Documentation/mm/oom.rst
> index 18e9e40c1ec1..2259f871a4a7 100644
> --- a/Documentation/mm/oom.rst
> +++ b/Documentation/mm/oom.rst
> @@ -3,3 +3,70 @@
> ======================
> Out Of Memory Handling
> ======================
> +
> +When the kernel cannot satisfy a memory allocation after exhausting reclaim,
> +compaction, and memory reserves, it invokes the OOM killer to terminate a
I mean this is just actively wrong to start with.
> +process and free memory. The implementation is in ``mm/oom_kill.c``.
Terminate a 'process', even what that is tricky in kernel vs userland...
> +
> +Victim Selection
> +================
> +
> +The OOM killer scores every eligible process and kills the one with the
> +highest score. The score is the sum of the process's resident pages, swap
> +entries, and page table pages. This sum is then adjusted by the per-process
> +``oom_score_adj`` tunable (range -1000 to 1000, default 0), which biases
> +the score by ``oom_score_adj * totalpages / 1000``. Setting
> +``oom_score_adj`` to -1000 disables OOM killing for that process entirely.
> +
> +The ``totalpages`` baseline depends on the allocation constraint:
> +
> +- **Unconstrained**: all RAM plus swap.
> +- **Cpuset**: memory on nodes in the current cpuset.
> +- **Memory policy**: memory on nodes in the current mempolicy.
> +- **Memory cgroup**: the cgroup's memory limit.
> +
> +Only processes that can use memory within the constraint are considered.
> +Kernel threads and init are never eligible.
> +
> +OOM Reaper
> +==========
> +
> +Sending SIGKILL does not immediately free memory — the victim must be
> +scheduled, unwind its stack, and tear down its address space. To speed
> +this up, the OOM reaper kernel thread (available on MMU systems) proactively
> +unmaps the victim's anonymous and private pages without waiting for the
Anonymous AND private eh?
> +victim to exit.
Actually there IS some waiting for a specific futex case :)) though maybe
removed now.
> +
> +The reaper gives the victim a short window to exit naturally before
> +intervening. It walks the victim's VMAs in reverse and calls
Why in reverse? Moon walk?
I mean etc. etc. this is really not helpful.
> +``unmap_page_range()`` to release physical pages. Once reaping completes
> +(or is no longer possible), the mm is marked ``MMF_OOM_SKIP`` so the OOM
> +killer skips it in future invocations.
> +
> +Before reaping, the mm is marked ``MMF_UNSTABLE`` to signal page fault
> +handlers that private mappings may have been zeroed and are no longer
> +reliable.
> +
> +process_mrelease
> +================
> +
> +The ``process_mrelease(pidfd, flags)`` system call lets userspace OOM
> +managers (such as systemd-oomd or Android's lmkd) trigger the same reaping
> +mechanism on a dying process without waiting for the kernel OOM killer.
> +It operates on a process that is already exiting and performs the same
> +address space teardown that the OOM reaper would.
> +
> +Sysctl Knobs
> +============
> +
> +``vm.panic_on_oom``
> + 0 (default): kill a process. 1: panic on unconstrained OOM only.
> + 2: always panic.
> +
> +``vm.oom_kill_allocating_task``
> + When non-zero, kill the task that triggered the OOM rather than scanning
> + for the largest process.
> +
> +``vm.oom_dump_tasks``
> + When non-zero (default), dump a table of all eligible tasks and their
> + memory usage to the kernel log before killing.
> --
> 2.53.0
>
>
>
next prev parent reply other threads:[~2026-03-15 20:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-14 15:25 Kit Dallege
2026-03-15 20:48 ` Lorenzo Stoakes (Oracle) [this message]
2026-03-16 7:32 ` Michal Hocko
2026-03-16 14:16 ` Lorenzo Stoakes (Oracle)
2026-03-16 14:53 ` Michal Hocko
2026-03-16 15:06 ` Jonathan Corbet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbee0ca1-4de6-4182-865b-a33d9ed32ee4@lucifer.local \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=xaum.io@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox