[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210901134200.GA50993@shbuild999.sh.intel.com>
Date: Wed, 1 Sep 2021 21:42:00 +0800
From: Feng Tang <feng.tang@...el.com>
To: David Rientjes <rientjes@...gle.com>,
Michal Hocko <mhocko@...e.com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <christian@...uner.io>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] mm/oom: detect and kill task which has allocation
forbidden by cpuset limit
On Wed, Sep 01, 2021 at 10:44:02AM +0800, Tang, Feng wrote:
[SNIP]
> > So I'd agree in this case that it would be better to simply fail the
> > allocation.
>
> I agree with yours and Michal's comments, putting it in the OOM code
> is a little late and wastes cpu cycles.
>
> > 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?
>
> Will explore more in this direction, thanks!
I tried below patch, which can solve the blindly killing issue, that
the docker processes will see page allocation errors, and eventually
quit running.
Thanks,
Feng
---
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index eeb3a9cb36bb..d1ae77be45a2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4271,10 +4271,18 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
.gfp_mask = gfp_mask,
.order = order,
};
- struct page *page;
+ struct page *page = NULL;
+ struct zoneref *z;
*did_some_progress = 0;
+ if (cpusets_enabled() && (gfp_mask & __GFP_HARDWALL)) {
+ z = first_zones_zonelist(ac->zonelist,
+ gfp_zone(gfp_mask), &cpuset_current_mems_allowed);
+ if (!z->zone)
+ goto out;
+ }
+
/*
* Acquire the oom lock. If that fails, somebody else is
* making progress for us.
Powered by blists - more mailing lists