Re: [RFC PATCH] mm/oom: detect and kill task which has allocation forbidden by cpuset limit

From: David Rientjes
Date: Tue Aug 31 2021 - 21:06:23 EST


On Tue, 31 Aug 2021, Michal Hocko wrote:

> I do not like this solution TBH. We know that that it is impossible to
> satisfy the allocation at the page allocator level so dealing with it at
> the OOM killer level is just a bad layering and a lot of wasted cycles
> to reach that point. Why cannot we simply fail the allocation if cpusets
> filtering leads to an empty zone intersection?

Cpusets will guarantee our effective nodemask will include at least one
node in N_MEMORY (cpuset_mems_allowed()) so we'll always have at least one
zone in our zonelist.

Issue in this case appears to be that the zone will never satisfy
non-movable allocations. I think this would be very similar to a GFP_DMA
allocation when bound to a node without lowmem, in which case we get a
page allocation failure. We don't kill current like this patch.

So I'd agree in this case that it would be better to simply fail the
allocation.

Feng, would you move this check to __alloc_pages_may_oom() like the other
special cases and simply fail rather than call into the oom killer?