On Wed 15-01-25 12:35:37, Rik van Riel wrote: > On Tue, 2025-01-14 at 20:42 +0100, Michal Hocko wrote: > > O > > I do agreee that a memory deadlock is not really proper way to deal > > with > > the issue. I have to admit that my understanding was based on ENOMEM > > being properly propagated out of in kernel user page faults. > > It looks like it kind of is. > > In case of VM_FAULT_OOM, the page fault code calls > kernelmode_fixup_or_oops(), which a few functions > down calls ex_handler_default(), which advances > regs->ip to the next instruction after the one > that faulted. OK, so we do not have the endless loop. Good. Sorry I didn't get to read through the fixup tables maze. Thanks for confirming. > Of course, if we have a copy_from_user loop, we > could end up there a bunch of times :) Yes, the robust list might have many elements and if each and every is swapped out then this can take a lot of time if the reclaim path is desperately retrying the whole reclaim. All that being said, does the change (partial revert) suggested by Johannes diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7b3503d12aaf..9c30c442e3b0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1627,7 +1627,7 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, * A few threads which were not waiting at mutex_lock_killable() can * fail to bail out. Therefore, check again after holding oom_lock. */ - ret = task_is_dying() || out_of_memory(&oc); + ret = out_of_memory(&oc); unlock: mutex_unlock(&oom_lock); Or is the exit still taking unbearably too long? If yes maybe we can help to ENOMEM already killed and oom reaped tasks earlier? -- Michal Hocko SUSE Labs