From: Feng Tang <feng.tang@intel.com>
To: David Rientjes <rientjes@google.com>, Michal Hocko <mhocko@suse.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Christian Brauner <christian@brauner.io>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] mm/oom: detect and kill task which has allocation forbidden by cpuset limit
Date: Wed, 1 Sep 2021 21:42:00 +0800 [thread overview]
Message-ID: <20210901134200.GA50993@shbuild999.sh.intel.com> (raw)
In-Reply-To: <20210901024402.GB46357@shbuild999.sh.intel.com>
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.
next prev parent reply other threads:[~2021-09-01 13:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 8:38 [RFC PATCH] mm/oom: detect and kill task which has allocation forbidden by cpuset limit Feng Tang
2021-08-31 15:57 ` Michal Hocko
2021-09-01 1:06 ` David Rientjes
2021-09-01 2:44 ` Feng Tang
2021-09-01 13:42 ` Feng Tang [this message]
2021-09-01 14:05 ` Michal Hocko
2021-09-02 7:34 ` Feng Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210901134200.GA50993@shbuild999.sh.intel.com \
--to=feng.tang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=christian@brauner.io \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).