[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd7939ea-74de-472b-8b00-b4d982eedcc7@lucifer.local>
Date: Fri, 29 Aug 2025 10:57:33 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: zhongjinji <zhongjinji@...or.com>
Cc: mhocko@...e.com, 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, surenb@...gle.com, liulu.liu@...or.com,
feng.han@...or.com, tianxiaobin@...or.com, fengbaopeng@...or.com
Subject: Re: [PATCH v6 1/2] mm/oom_kill: Do not delay oom reaper when the
victim is frozen
On Fri, Aug 29, 2025 at 02:55:49PM +0800, zhongjinji wrote:
> The oom reaper is a mechanism to guarantee a forward process during OOM
> situation when the oom victim cannot terminate on its own (e.g. being
> blocked in uninterruptible state or frozen by cgroup freezer). In order
> to give the victim some time to terminate properly the oom reaper is
> delayed in its invocation. This is particularly beneficial when the oom
> victim is holding robust futex resources as the anonymous memory tear
> down can break those. [1]
>
> On the other hand deliberately frozen tasks by the freezer cgroup will
> not wake up until they are thawed in the userspace and delay is
> effectively pointless. Therefore opt out from the delay for cgroup
> frozen oom victims.
>
> Reference:
> [1] https://lore.kernel.org/all/20220414144042.677008-1-npache@redhat.com/T/#u
>
> Signed-off-by: zhongjinji <zhongjinji@...or.com>
Nice :) now this is very simple.
LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> ---
> mm/oom_kill.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 25923cfec9c6..a5e9074896a1 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -700,7 +700,14 @@ static void queue_oom_reaper(struct task_struct *tsk)
>
> get_task_struct(tsk);
> timer_setup(&tsk->oom_reaper_timer, wake_oom_reaper, 0);
> - tsk->oom_reaper_timer.expires = jiffies + OOM_REAPER_DELAY;
> + tsk->oom_reaper_timer.expires = jiffies;
> +
> + /*
> + * If the task is frozen by the cgroup freezer, the delay is unnecessary
> + * because it cannot exit until thawed. Skip the delay for frozen victims.
> + */
> + if (!frozen(tsk))
> + tsk->oom_reaper_timer.expires += OOM_REAPER_DELAY;
> add_timer(&tsk->oom_reaper_timer);
> }
>
> --
> 2.17.1
>
Powered by blists - more mailing lists