linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Oleg Nesterov <oleg@redhat.com>,
	Vladimir Davydov <vdavydov@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Markus Trippelsdorf <markus@trippelsdorf.de>,
	Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>,
	Ralf-Peter Rohbeck <Ralf-Peter.Rohbeck@quantum.com>,
	Jiri Slaby <jslaby@suse.com>, Olaf Hering <olaf@aepfle.de>,
	Joonsoo Kim <js1304@gmail.com>, linux-mm <linux-mm@kvack.org>
Subject: Re: More OOM problems
Date: Mon, 19 Sep 2016 00:00:24 +0200	[thread overview]
Message-ID: <6aa81fe3-7f04-78d7-d477-609a7acd351a@suse.cz> (raw)
In-Reply-To: <CA+55aFwu30Yz52yW+MRHt_JgpqZkq4DHdWR-pX4+gO_OK7agCQ@mail.gmail.com>

On 09/18/2016 10:03 PM, Linus Torvalds wrote:
> [ More or less random collection of people from previous oom patches 
> and/or discussions, if you feel you shouldn't have been cc'd, blame
> me for just picking things from earlier threads and/or commits ]
> 
> I'm afraid that the oom situation is still not fixed, and the "let's 
> die quickly" patches are still a nasty regression.

So I'm trying to understand the core of the regression compared to
pre-4.7. It can't be the compaction feedback, as that was reverted, and
compaction itself shouldn't perform worse than pre-4.7. This leaves us
with should_reclaim_retry() false. This can return false if:

1) no_progress_loops > MAX_RECLAIM_RETRIES

But we have in __allow_pages_slowpath() this:

if (did_some_progress && order <= PAGE_ALLOC_COSTLY_ORDER)
no_progress_loops = 0;

I doubt reclaim makes no progress in your case, and the non-costly order
is also true. So, unlikely.

2) The watermark check that includes estimate for pages available for
reclaim fails.

Could be the backoff in calculation of "available" in
should_reclaim_retry() is too aggressive. But it depends on the
no_progress_loops which I think is 0 (see above). Again, unlikely.

But the watermark check doesn't actually work for order-1+ allocations,
the "available" estimate only affects order-0 check. For higher orders
it will be false if the page of sufficient order doesn't already exist.
That's fine if we trust should_compact_retry() in such case.

But Joonsoo already had a theoretical scenario where this can fall apart:
http://lkml.kernel.org/r/<20160824050157.GA22781@js1304-P5Q-DELUXE>

See the part that starts at "Assume following situation:". I suspect
something like that happened here.

I think at least temporarily we'll have to make the watermark check
to be order-0 check for non-costly orders.

Something like below (untested)?

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a2214c64ed3c..9b3b3a79c58a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3347,17 +3347,24 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
 					ac->nodemask) {
 		unsigned long available;
 		unsigned long reclaimable;
+		int check_order = order;
+		unsigned long watermark = min_wmark_pages(zone);
 
 		available = reclaimable = zone_reclaimable_pages(zone);
 		available -= DIV_ROUND_UP(no_progress_loops * available,
 					  MAX_RECLAIM_RETRIES);
 		available += zone_page_state_snapshot(zone, NR_FREE_PAGES);
 
+		if (order > 0 && order <= PAGE_ALLOC_COSTLY_ORDER) {
+			check_order = 0;
+			watermark += 1UL << order;
+		}
+
 		/*
 		 * Would the allocation succeed if we reclaimed the whole
 		 * available?
 		 */
-		if (__zone_watermark_ok(zone, order, min_wmark_pages(zone),
+		if (__zone_watermark_ok(zone, check_order, watermark,
 				ac_classzone_idx(ac), alloc_flags, available)) {
 			/*
 			 * If we didn't make any progress and have a lot of

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2016-09-18 22:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-18 20:03 Linus Torvalds
2016-09-18 20:26 ` Lorenzo Stoakes
2016-09-18 20:58   ` Linus Torvalds
2016-09-18 21:13     ` Vlastimil Babka
2016-09-18 21:34       ` Lorenzo Stoakes
2016-09-19  8:32   ` Michal Hocko
2016-09-19  8:42     ` Lorenzo Stoakes
2016-09-19  8:53       ` Michal Hocko
2016-09-25 21:48         ` Lorenzo Stoakes
2016-09-26  7:48           ` Michal Hocko
2016-09-18 21:00 ` Vlastimil Babka
2016-09-18 21:18   ` Linus Torvalds
2016-09-19  6:27     ` Jiri Slaby
2016-09-19  7:01     ` Michal Hocko
2016-09-19  7:52       ` Michal Hocko
2016-09-19  1:07   ` Andi Kleen
     [not found]     ` <alpine.DEB.2.20.1609190836540.12121@east.gentwo.org>
2016-09-19 14:31       ` Andi Kleen
2016-09-19 14:39         ` Michal Hocko
2016-09-19 14:41         ` Vlastimil Babka
2016-09-19 18:18           ` Linus Torvalds
2016-09-19 19:57           ` Christoph Lameter
2016-09-18 22:00 ` Vlastimil Babka [this message]
2016-09-19  6:56   ` Michal Hocko
2016-09-19  6:48 ` Michal Hocko
2016-09-21  7:04 ` Raymond Jennings
2016-09-21  7:29   ` Michal Hocko
2016-09-29  6:12   ` More OOM problems (sorry fro the mail bomb) Raymond Jennings
2016-09-29  7:03     ` Vlastimil Babka
2016-09-29 20:08       ` Raymond Jennings
2016-09-29 21:20         ` Vlastimil Babka
2016-09-30 19:48           ` Raymond Jennings
     [not found] <eafb59b5-0a2b-0e28-ca79-f044470a2851@Quantum.com>
     [not found] ` <20160930214448.GB28379@dhcp22.suse.cz>
     [not found]   ` <982671bd-5733-0cd5-c15d-112648ff14c5@Quantum.com>
2016-10-11  6:44     ` More OOM problems Michal Hocko
2016-10-11  7:10       ` Vlastimil Babka
2016-10-30  4:17         ` Simon Kirby
2016-10-31 21:41           ` Vlastimil Babka
2016-10-31 21:51             ` Vlastimil Babka

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=6aa81fe3-7f04-78d7-d477-609a7acd351a@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Ralf-Peter.Rohbeck@quantum.com \
    --cc=a.miskiewicz@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=js1304@gmail.com \
    --cc=jslaby@suse.com \
    --cc=linux-mm@kvack.org \
    --cc=markus@trippelsdorf.de \
    --cc=mhocko@kernel.org \
    --cc=olaf@aepfle.de \
    --cc=oleg@redhat.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=torvalds@linux-foundation.org \
    --cc=vdavydov@parallels.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