[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLg0QZQ5kXNJgDMF@tiehlicka>
Date: Wed, 3 Sep 2025 14:27:45 +0200
From: Michal Hocko <mhocko@...e.com>
To: zhongjinji <zhongjinji@...or.com>
Cc: rientjes@...gle.com, shakeel.butt@...ux.dev, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
tglx@...utronix.de, liam.howlett@...cle.com,
lorenzo.stoakes@...cle.com, surenb@...gle.com, liulu.liu@...or.com,
feng.han@...or.com
Subject: Re: [PATCH v7 1/2] mm/oom_kill: Thaw victim on a per-process basis
instead of per-thread
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@...or.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
Powered by blists - more mailing lists