Re: [PATCH] memcg: bypass the reclaim and oom killer for dying tasks once oom_reaper is done
Andrew Morton <[email protected]> Wed, 29 Jul 2026 18:13:49 -0700
| Newsgroups | org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 28 Jul 2026 19:46:12 -0700 Shakeel Butt <[email protected]> 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? > --- 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?