Re: [patch] mm, oom: stop reclaiming if GFP_ATOMIC will start failing soon

From: Michal Hocko
Date: Wed Apr 29 2020 - 07:43:35 EST


On Wed 29-04-20 19:45:07, Tetsuo Handa wrote:
> On 2020/04/29 18:04, Michal Hocko wrote:
> > Completely agreed! The in kernel OOM killer is to deal with situations
> > when memory is desperately depleted without any sign of a forward
> > progress. If there is a reclaimable memory then we are not there yet.
> > If a workload can benefit from early oom killing based on response time
> > then we have facilities to achieve that (e.g. PSI).
>
> Can PSI work even if userspace process cannot avoid reclaimable memory
> allocations (e.g. page fault, file read) is already stalling?

The userspace itself would have to be careful and use mlock of course.
But collecting the psi information itself should be pretty independent
on memory allocations as monitoring the system memory state is one of
the main usecases.

> I'm not sure
> whether PSI allows responding quickly enough to "keep reclaimable memory
> allocations not to reclaim" despite there is still reclaimable memory...

PSI is supposed to monitor time spent in the memory allocator (among
other things) and report the tendency. This should be a sufficient
metric to judge that a large part of the userspace is not making forward
progress.
--
Michal Hocko
SUSE Labs