From: Michal Hocko <mhocko@suse.com>
To: zhongjinji <zhongjinji@honor.com>
Cc: rientjes@google.com, shakeel.butt@linux.dev,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, tglx@linutronix.de,
liam.howlett@oracle.com, lorenzo.stoakes@oracle.com,
surenb@google.com, liulu.liu@honor.com, feng.han@honor.com
Subject: Re: [PATCH v7 1/2] mm/oom_kill: Thaw victim on a per-process basis instead of per-thread
Date: Wed, 3 Sep 2025 14:27:45 +0200 [thread overview]
Message-ID: <aLg0QZQ5kXNJgDMF@tiehlicka> (raw)
In-Reply-To: <20250903092729.10611-2-zhongjinji@honor.com>
On Wed 03-09-25 17:27:28, zhongjinji wrote:
> OOM killer is a mechanism that selects and kills processes when the system
> runs out of memory to reclaim resources and keep the system stable.
> However, the oom victim cannot terminate on its own when it is frozen,
> because __thaw_task() only thaws one thread of the victim, while
> the other threads remain in the frozen state.
>
> This change will thaw the entire victim process when OOM occurs,
> ensuring that the oom victim can terminate on its own.
>
> Signed-off-by: zhongjinji <zhongjinji@honor.com>
> ---
> mm/oom_kill.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 25923cfec9c6..3caaafc896d4 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -747,6 +747,19 @@ static inline void queue_oom_reaper(struct task_struct *tsk)
> }
> #endif /* CONFIG_MMU */
>
> +static void thaw_oom_process(struct task_struct *tsk)
> +{
> + struct task_struct *t;
> +
> + /* protects against __exit_signal() */
> + read_lock(&tasklist_lock);
> + for_each_thread(tsk, t) {
> + set_tsk_thread_flag(t, TIF_MEMDIE);
> + __thaw_task(t);
> + }
> + read_unlock(&tasklist_lock);
> +}
> +
Sorry, I was probably not clear enough. I meant thaw_process should live
in the freezer proper kernel/freezer.c and oom should be just user.
Please make sure that freezer maintainers are involved and approve the
change.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2025-09-03 12:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 9:27 [PATCH v7 0/2] Improvements for victim thawing and reaper VMA traversal zhongjinji
2025-09-03 9:27 ` [PATCH v7 1/2] mm/oom_kill: Thaw victim on a per-process basis instead of per-thread zhongjinji
2025-09-03 12:27 ` Michal Hocko [this message]
2025-09-04 13:08 ` zhongjinji
2025-09-03 9:27 ` [PATCH v7 2/2] mm/oom_kill: The OOM reaper traverses the VMA maple tree in reverse order zhongjinji
2025-09-03 12:58 ` Michal Hocko
2025-09-03 19:02 ` Liam R. Howlett
2025-09-04 12:21 ` Michal Hocko
2025-09-05 2:12 ` Liam R. Howlett
2025-09-05 9:20 ` Michal Hocko
2025-09-04 12:47 ` zhongjinji
2025-09-04 12:24 ` zhongjinji
2025-09-04 14:48 ` Michal Hocko
2025-09-08 12:15 ` [PATCH v7 2/2] mm/oom_kill: The OOM reaper traverses the VMA zhongjinji
2025-09-04 23:50 ` [PATCH v7 2/2] mm/oom_kill: The OOM reaper traverses the VMA maple tree in reverse order Shakeel Butt
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=aLg0QZQ5kXNJgDMF@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=feng.han@honor.com \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liulu.liu@honor.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=rientjes@google.com \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
--cc=zhongjinji@honor.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