From: Shakeel Butt <shakeel.butt@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>,
David Rientjes <rientjes@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Suren Baghdasaryan <surenb@google.com>,
Usama Arif <usama.arif@linux.dev>,
Rik van Riel <riel@surriel.com>, Nhat Pham <nphamcs@gmail.com>,
Meta kernel team <kernel-team@meta.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memcg: bypass the reclaim and oom killer for dying tasks once oom_reaper is done
Date: Wed, 29 Jul 2026 21:37:08 -0700 [thread overview]
Message-ID: <amrUQZDNNJMdl_aP@linux.dev> (raw)
In-Reply-To: <20260729181349.fd41f1a09ec19c9cfb0c412f@linux-foundation.org>
On Wed, Jul 29, 2026 at 06:13:49PM -0700, Andrew Morton wrote:
> On Tue, 28 Jul 2026 19:46:12 -0700 Shakeel Butt <shakeel.butt@linux.dev> wrote:
>
> > At Meta, we are seeing instances where an OOM killed job is stuck in the
> > exit path for several hours. In one particular case, the job was stuck
> > for more than 8 hours and I had to manually remove the memory.max limits
> > to allow the process to exit.
>
> Not seeing the problem here - that sounds like normal kernel behavior ;)
>
> > Reproduced with 20k threads, each parking a robust futex head on
> > its own zswapped page, OOM-group-killed while a sibling holds mmap_lock
> > for write so the reaper gives up and sets MMF_OOM_SKIP. Tested on
> > next-20260728 and baseline show ~90 seconds exit time while with the
> > patch the exit time reduced to ~3 seconds.
>
> Very positive.
>
> But it doesn't sound like you're fully confident that the problem is
> fully solved?
Yes as I am not able to reproduce multi hour stall, so I might be missing
something else. The patch at least fixes the issue which I am able to reproduce.
>
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2653,6 +2653,19 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
> > if (!gfpflags_allow_blocking(gfp_mask))
> > goto nomem;
> >
> > + /*
> > + * OOM victim still needs to charge memory to exit. OOM reaper should
> > + * help but it might fail on mmap_lock contention. If the victim is a
> > + * large thread group then all exiting threads might compete on oom_lock
> > + * just to learn that there is nothing really killable anymore. Bail
> > + * out early and fail the charge to expedite their exit. They are
> > + * considered fully reclaimed by the oom reaper and they shouldn't
> > + * contribute further charges.
> > + */
> > + if (tsk_is_oom_victim(current) &&
> > + mm_flags_test(MMF_OOM_SKIP, current->signal->oom_mm))
> > + goto nomem;
> > +
> > __memcg_memory_event(mem_over_limit, MEMCG_MAX, allow_spinning);
> > raised_max_event = true;
>
> Should we backport this?
I don't have any strong opinion. I wanted to deploy this patch in Meta fleet to
get some exposure. Maybe backporting will give more exposure to it.
next prev parent reply other threads:[~2026-07-30 4:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 2:46 [PATCH] memcg: bypass the reclaim and oom killer for dying tasks once oom_reaper is done Shakeel Butt
2026-07-29 18:51 ` Johannes Weiner
2026-07-30 1:13 ` Andrew Morton
2026-07-30 4:37 ` Shakeel Butt [this message]
2026-07-30 6:57 ` Michal Hocko
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=amrUQZDNNJMdl_aP@linux.dev \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=riel@surriel.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.