From: zhongjinji <zhongjinji@honor.com>
To: <mhocko@suse.com>
Cc: <rientjes@google.com>, <shakeel.butt@linux.dev>,
<akpm@linux-foundation.org>, <tglx@linutronix.de>,
<liam.howlett@oracle.com>, <lorenzo.stoakes@oracle.com>,
<surenb@google.com>, <lenb@kernel.org>, <rafael@kernel.org>,
<pavel@kernel.org>, <linux-mm@kvack.org>,
<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<liulu.liu@honor.com>, <feng.han@honor.com>,
<zhongjinji@honor.com>
Subject: [PATCH v8 0/3] Improvements to Victim Process Thawing and OOM Reaper Traversal Order
Date: Tue, 9 Sep 2025 17:06:56 +0800 [thread overview]
Message-ID: <20250909090659.26400-1-zhongjinji@honor.com> (raw)
This patch series focuses on optimizing victim process thawing and refining
the traversal order of the OOM reaper. Since __thaw_task is used to thaw a
single thread of the victim, thawing only one thread cannot guarantee the
exit of the OOM victim when it is frozen. Patch 1 and patch 2 thaw the entire
process of the OOM victim to ensure that OOM victims are able to terminate
themselves. Even if the oom_reaper is delayed, patch 3 is still beneficial
for reaping processes with a large address space footprint, and it also
greatly improves process_mrelease.
---
v7 -> v8:
- Introduce thaw_oom_process() for thawing OOM victims. [12]
- Use RCU protection for thread traversal in thaw_oom_process.
v6 -> v7:
- Thawing the victim process to ensure that it can terminate on its own. [10]
- Since the delay reaper is no longer skipped, I'm not sure whether patch 2
will still be accepted. Revise the Changelog for patch 2. [11]
- Remove report tags
v5 -> v6:
- Use mas_for_each_rev() for VMA traversal [6]
- Simplify the judgment of whether to delay in queue_oom_reaper() [7]
- Refine changelog to better capture the essence of the changes [8]
- Use READ_ONCE(tsk->frozen) instead of checking mm and additional
checks inside for_each_process(), as it is sufficient [9]
- Add report tags because fengbaopeng and tianxiaobin reported the
high load issue of the reaper
v4 -> v5:
- Detect frozen state directly, avoid special futex handling. [3]
- Use mas_find_rev() for VMA traversal to avoid skipping entries. [4]
- Only check should_delay_oom_reap() in queue_oom_reaper(). [5]
v3 -> v4:
- Renamed functions and parameters for clarity. [2]
- Added should_delay_oom_reap() for OOM reap decisions.
- Traverse maple tree in reverse for improved behavior.
v2 -> v3:
- Fixed Subject prefix error.
v1 -> v2:
- Check robust_list for all threads, not just one. [1]
Reference:
[1] https://lore.kernel.org/linux-mm/u3mepw3oxj7cywezna4v72y2hvyc7bafkmsbirsbfuf34zpa7c@b23sc3rvp2gp/
[2] https://lore.kernel.org/linux-mm/87cy99g3k6.ffs@tglx/
[3] https://lore.kernel.org/linux-mm/aKRWtjRhE_HgFlp2@tiehlicka/
[4] https://lore.kernel.org/linux-mm/26larxehoe3a627s4fxsqghriwctays4opm4hhme3uk7ybjc5r@pmwh4s4yv7lm/
[5] https://lore.kernel.org/linux-mm/d5013a33-c08a-44c5-a67f-9dc8fd73c969@lucifer.local/
[6] https://lore.kernel.org/linux-mm/nwh7gegmvoisbxlsfwslobpbqku376uxdj2z32owkbftvozt3x@4dfet73fh2yy/
[7] https://lore.kernel.org/linux-mm/af4edeaf-d3c9-46a9-a300-dbaf5936e7d6@lucifer.local/
[8] https://lore.kernel.org/linux-mm/aK71W1ITmC_4I_RY@tiehlicka/
[9] https://lore.kernel.org/linux-mm/jzzdeczuyraup2zrspl6b74muf3bly2a3acejfftcldfmz4ekk@s5mcbeim34my/
[10] https://lore.kernel.org/linux-mm/aLWmf6qZHTA0hMpU@tiehlicka/
[11] https://lore.kernel.org/linux-mm/aLVOICSkyvVRKD94@tiehlicka/
[12] https://lore.kernel.org/linux-mm/aLg0QZQ5kXNJgDMF@tiehlicka/
The earlier post:
v7: https://lore.kernel.org/linux-mm/20250903092729.10611-1-zhongjinji@honor.com/
v6: https://lore.kernel.org/linux-mm/20250829065550.29571-1-zhongjinji@honor.com/
v5: https://lore.kernel.org/linux-mm/20250825133855.30229-1-zhongjinji@honor.com/
v4: https://lore.kernel.org/linux-mm/20250814135555.17493-1-zhongjinji@honor.com/
v3: https://lore.kernel.org/linux-mm/20250804030341.18619-1-zhongjinji@honor.com/
v2: https://lore.kernel.org/linux-mm/20250801153649.23244-1-zhongjinji@honor.com/
v1: https://lore.kernel.org/linux-mm/20250731102904.8615-1-zhongjinji@honor.com/
zhongjinji (3):
mm/oom_kill: Introduce thaw_oom_process() for thawing OOM victims
mm/oom_kill: Thaw the entire OOM victim process
mm/oom_kill: OOM reaper walks VMA maple tree in reverse order
include/linux/freezer.h | 2 ++
kernel/freezer.c | 19 +++++++++++++++++++
mm/oom_kill.c | 16 +++++++++++-----
3 files changed, 32 insertions(+), 5 deletions(-)
--
2.17.1
next reply other threads:[~2025-09-09 9:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 9:06 zhongjinji [this message]
2025-09-09 9:06 ` [PATCH v8 1/3] mm/oom_kill: Introduce thaw_oom_process() for thawing OOM victims zhongjinji
2025-09-09 9:15 ` Michal Hocko
2025-09-09 16:27 ` Suren Baghdasaryan
2025-09-09 16:44 ` Michal Hocko
2025-09-09 16:53 ` Suren Baghdasaryan
2025-09-09 9:06 ` [PATCH v8 2/3] mm/oom_kill: Thaw the entire OOM victim process zhongjinji
2025-09-09 9:15 ` Michal Hocko
2025-09-09 11:41 ` [PATCH v8 1/3] mm/oom_kill: Introduce thaw_oom_process() for thawing OOM victims zhongjinji
2025-09-09 11:59 ` Michal Hocko
2025-09-09 13:51 ` zhongjinji
2025-09-09 14:02 ` Michal Hocko
2025-09-09 14:47 ` zhongjinji
2025-09-09 16:23 ` [PATCH v8 2/3] mm/oom_kill: Thaw the entire OOM victim process Suren Baghdasaryan
2025-09-09 9:06 ` [PATCH v8 3/3] mm/oom_kill: The OOM reaper traverses the VMA maple tree in reverse order zhongjinji
2025-09-09 16:29 ` Suren Baghdasaryan
2025-09-09 16:30 ` Suren Baghdasaryan
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=20250909090659.26400-1-zhongjinji@honor.com \
--to=zhongjinji@honor.com \
--cc=akpm@linux-foundation.org \
--cc=feng.han@honor.com \
--cc=lenb@kernel.org \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=liulu.liu@honor.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=rientjes@google.com \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
/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