Re: [PATCH] mm: allow exiting processes to exceed the memory.max limit
From: Rik van Riel
Date: Mon Dec 09 2024 - 15:00:57 EST
On Mon, 2024-12-09 at 19:08 +0100, Michal Hocko wrote:
> On Mon 09-12-24 12:42:33, Rik van Riel wrote:
> > It is possible for programs to get stuck in exit, when their
> > memcg is at or above the memory.max limit, and things like
> > the do_futex() call from mm_release() need to page memory in.
> >
> > This can hang forever, but it really doesn't have to.
>
> Are you sure this is really happening?
It turns out it wasn't really forever.
After about a day the zombie task I was bpftracing,
to figure out exactly what was going wrong, finally
succeeded in exiting.
I got as far as seeing try_to_free_mem_cgroup_pages return 0
many, times in a row, looping in try_charge_memcg, which
occasionally returned -ENOMEM to the caller, who then retried
several times.
Each invocation of try_to_free_mem_cgroup_pages also saw
a large number of unsuccessful calls to shrink_folio_list.
It looks like what might be happening instead is that
faultin_page() returns 0 after getting back VM_FAULT_OOM
from handle_mm_fault, causing __get_user_pages() to loop.
Let me send a patch to fix that, instead!
--
All Rights Reversed.