From: Mike Kravetz <mike.kravetz@oracle.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [Question] Should direct reclaim time be bounded?
Date: Tue, 23 Apr 2019 09:39:47 -0700 [thread overview]
Message-ID: <eac582cf-2f76-4da1-1127-6bb5c8c959e4@oracle.com> (raw)
In-Reply-To: <20190423071953.GC25106@dhcp22.suse.cz>
On 4/23/19 12:19 AM, Michal Hocko wrote:
> On Mon 22-04-19 21:07:28, Mike Kravetz wrote:
>> In our distro kernel, I am thinking about making allocations try "less hard"
>> on nodes where we start to see failures. less hard == NORETRY/NORECLAIM.
>> I was going to try something like this on an upstream kernel when I noticed
>> that it seems like direct reclaim may never end/exit. It 'may' exit, but I
>> instrumented __alloc_pages_slowpath() and saw it take well over an hour
>> before I 'tricked' it into exiting.
>>
>> [ 5916.248341] hpage_slow_alloc: jiffies 5295742 tries 2 node 0 success
>> [ 5916.249271] reclaim 5295741 compact 1
>
> This is unexpected though. What does tries mean? Number of reclaim
> attempts? If yes could you enable tracing to see what takes so long in
> the reclaim path?
tries is the number of times we pass the 'retry:' label in
__alloc_pages_slowpath. In this specific case, I am pretty sure all that
time is in one call to __alloc_pages_direct_reclaim. My 'trick' to make this
succeed was to "echo 0 > nr_hugepages" in another shell.
>> This is where it stalled after "echo 4096 > nr_hugepages" on a little VM
>> with 8GB total memory.
>>
>> I have not started looking at the direct reclaim code to see exactly where
>> we may be stuck, or trying really hard. My question is, "Is this expected
>> or should direct reclaim be somewhat bounded?" With __alloc_pages_slowpath
>> getting 'stuck' in direct reclaim, the documented behavior for huge page
>> allocation is not going to happen.
>
> Well, our "how hard to try for hugetlb pages" is quite arbitrary. We
> used to rety as long as at least order worth of pages have been
> reclaimed but that didn't make any sense since the lumpy reclaim was
> gone.
Yes, that is what I am seeing in our older distro kernel and I can at least
deal with that.
> So the semantic has change to reclaim&compact as long as there is
> some progress. From what I understad above it seems that you are not
> thrashing and calling reclaim again and again but rather one reclaim
> round takes ages.
Correct
> That being said, I do not think __GFP_RETRY_MAYFAIL is wrong here. It
> looks like there is something wrong in the reclaim going on.
Ok, I will start digging into that. Just wanted to make sure before I got
into it too deep.
BTW - This is very easy to reproduce. Just try to allocate more huge pages
than will fit into memory. I see this 'reclaim taking forever' behavior on
v5.1-rc5-mmotm-2019-04-19-14-53. Looks like it was there in v5.0 as well.
--
Mike Kravetz
next prev parent reply other threads:[~2019-04-23 16:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 4:07 [Question] Should direct reclaim time be bounded? Mike Kravetz
2019-04-23 7:19 ` Michal Hocko
2019-04-23 16:39 ` Mike Kravetz [this message]
2019-04-24 14:35 ` Vlastimil Babka
2019-06-28 18:20 ` Mike Kravetz
2019-07-01 8:59 ` Mel Gorman
2019-07-02 3:15 ` Mike Kravetz
2019-07-03 9:43 ` Mel Gorman
2019-07-03 23:54 ` Mike Kravetz
2019-07-04 11:09 ` Michal Hocko
2019-07-04 15:11 ` Mike Kravetz
2019-07-08 5:19 ` Hillf Danton
2019-07-10 18:42 ` Mike Kravetz
2019-07-10 19:44 ` Michal Hocko
2019-07-10 23:36 ` Mike Kravetz
2019-07-11 7:12 ` Michal Hocko
2019-07-12 9:49 ` Mel Gorman
2019-07-11 15:44 Hillf Danton
2019-07-12 5:47 Hillf Danton
2019-07-13 1:11 ` Mike Kravetz
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=eac582cf-2f76-4da1-1127-6bb5c8c959e4@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=aarcange@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=vbabka@suse.cz \
/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).