From: Vlastimil Babka <vbabka@suse.cz>
To: Rik van Riel <riel@redhat.com>, linux-kernel@vger.kernel.org
Cc: hannes@cmpxchg.org, akpm@linux-foundation.org, mgorman@suse.de
Subject: Re: [PATCH] mm: limit direct reclaim for higher order allocations
Date: Mon, 7 Mar 2016 16:42:19 +0100 [thread overview]
Message-ID: <56DDA15B.70006@suse.cz> (raw)
In-Reply-To: <20160224163850.3d7eb56c@annuminas.surriel.com>
On 02/24/2016 10:38 PM, Rik van Riel wrote:
> For multi page allocations smaller than PAGE_ALLOC_COSTLY_ORDER,
> the kernel will do direct reclaim if compaction failed for any
> reason. This worked fine when Linux systems had 128MB RAM, but
> on my 24GB system I frequently see higher order allocations
> free up over 3GB of memory, pushing all kinds of things into
> swap, and slowing down applications.
>
> It would be much better to limit the amount of reclaim done,
> rather than cause excessive pageout activity.
>
> When enough memory is free to do compaction for the highest order
> allocation possible, bail out of the direct page reclaim code.
>
> On smaller systems, this may be enough to obtain contiguous
> free memory areas to satisfy small allocations, continuing our
> strategy of relying on luck occasionally. On larger systems,
> relying on luck like that has not been working for years.
>
> Signed-off-by: Rik van Riel <riel@redhat.com>
So the main point of this patch is the change from "continue" to "return
true", right? This will prevent looking at other zones, but I guess
that's not the reason why without this patch reclaim frees 3 of 24GB for
you?
What I suspect more is should_continue_reclaim() where it wants to
reclaim (2UL << sc->order) pages regardless of watermark, or compaction
status. But that one is called from shrink_zone(), and shrink_zones()
should not call shrink_zone() if compaction is ready, even before this
patch. Perhaps if multiple processes manage to enter shrink_zone()
simultaneously, they could over-reclaim due to that?
> ---
> mm/vmscan.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index fc62546096f9..8dd15d514761 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2584,20 +2584,17 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
> continue; /* Let kswapd poll it */
>
> /*
> - * If we already have plenty of memory free for
> - * compaction in this zone, don't free any more.
> - * Even though compaction is invoked for any
> - * non-zero order, only frequent costly order
> - * reclamation is disruptive enough to become a
> - * noticeable problem, like transparent huge
> - * page allocations.
> + * For higher order allocations, free enough memory
> + * to be able to do compaction for the largest possible
> + * allocation. On smaller systems, this may be enough
> + * that smaller allocations can skip compaction, if
> + * enough adjacent pages get freed.
> */
> - if (IS_ENABLED(CONFIG_COMPACTION) &&
> - sc->order > PAGE_ALLOC_COSTLY_ORDER &&
> + if (IS_ENABLED(CONFIG_COMPACTION) && sc->order &&
> zonelist_zone_idx(z) <= requested_highidx &&
> - compaction_ready(zone, sc->order)) {
> + compaction_ready(zone, MAX_ORDER)) {
> sc->compaction_ready = true;
> - continue;
> + return true;
> }
>
> /*
>
prev parent reply other threads:[~2016-03-07 15:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 21:38 [PATCH] mm: limit direct reclaim for higher order allocations Rik van Riel
2016-02-24 22:15 ` David Rientjes
2016-02-24 22:17 ` Rik van Riel
2016-02-25 0:30 ` Joonsoo Kim
2016-02-25 2:47 ` Rik van Riel
2016-02-25 4:42 ` Joonsoo Kim
2016-02-24 23:02 ` Andrew Morton
2016-02-24 23:28 ` Rik van Riel
2016-02-25 14:43 ` Michal Hocko
2016-03-07 15:42 ` Vlastimil Babka [this message]
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=56DDA15B.70006@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=riel@redhat.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