From: Mike Kravetz <mike.kravetz@oracle.com>
To: Hillf Danton <hdanton@sina.com>, Mel Gorman <mgorman@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Michal Hocko <mhocko@kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [Question] Should direct reclaim time be bounded?
Date: Fri, 12 Jul 2019 18:11:30 -0700 [thread overview]
Message-ID: <c39e7cb3-204c-c4e3-fb43-7a37d91c0ccb@oracle.com> (raw)
In-Reply-To: <20190712054732.7264-1-hdanton@sina.com>
On 7/11/19 10:47 PM, Hillf Danton wrote:
>
> On Thu, 11 Jul 2019 02:42:56 +0800 Mike Kravetz wrote:
>>
>> It is quite easy to hit the condition where:
>> nr_reclaimed == 0 && nr_scanned == 0 is true, but we skip the previous test
>>
> Then skipping check of __GFP_RETRY_MAYFAIL makes no sense in your case.
> It is restored in respin below.
>
>> and the compaction check:
>> sc->nr_reclaimed < pages_for_compaction &&
>> inactive_lru_pages > pages_for_compaction
>> is true, so we return true before the below check of costly_fg_reclaim
>>
> This check is placed after COMPACT_SUCCESS; the latter is used to
> replace sc->nr_reclaimed < pages_for_compaction.
>
> And dryrun detection is added based on the result of last round of
> shrinking of inactive pages, particularly when their number is large
> enough.
>
Thanks Hillf.
This change does appear to eliminate the issue with stalls by
should_continue_reclaim returning true too often. I need to think
some more about exactly what is impacted with the change.
With this change, the problem moves to compaction with should_compact_retry
returning true too often. It is the same behavior seem when I simply removed
the __GFP_RETRY_MAYFAIL special casing in should_continue_reclaim.
At Mel's suggestion I removed the compaction_zonelist_suitable() call
from should_compact_retry. This eliminated the compaction stalls. Thanks
Mel.
With both changes, stalls appear to be eliminated. This is promising.
I'll try to refine these approaches and continue testing.
--
Mike Kravetz
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2571,18 +2571,6 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat,
> return false;
> }
>
> - /*
> - * If we have not reclaimed enough pages for compaction and the
> - * inactive lists are large enough, continue reclaiming
> - */
> - pages_for_compaction = compact_gap(sc->order);
> - inactive_lru_pages = node_page_state(pgdat, NR_INACTIVE_FILE);
> - if (get_nr_swap_pages() > 0)
> - inactive_lru_pages += node_page_state(pgdat, NR_INACTIVE_ANON);
> - if (sc->nr_reclaimed < pages_for_compaction &&
> - inactive_lru_pages > pages_for_compaction)
> - return true;
> -
> /* If compaction would go ahead or the allocation would succeed, stop */
> for (z = 0; z <= sc->reclaim_idx; z++) {
> struct zone *zone = &pgdat->node_zones[z];
> @@ -2598,7 +2586,21 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat,
> ;
> }
> }
> - return true;
> +
> + /*
> + * If we have not reclaimed enough pages for compaction and the
> + * inactive lists are large enough, continue reclaiming
> + */
> + pages_for_compaction = compact_gap(sc->order);
> + inactive_lru_pages = node_page_state(pgdat, NR_INACTIVE_FILE);
> + if (get_nr_swap_pages() > 0)
> + inactive_lru_pages += node_page_state(pgdat, NR_INACTIVE_ANON);
> +
> + return inactive_lru_pages > pages_for_compaction &&
> + /*
> + * avoid dryrun with plenty of inactive pages
> + */
> + nr_scanned && nr_reclaimed;
> }
>
> static bool pgdat_memcg_congested(pg_data_t *pgdat, struct mem_cgroup *memcg)
> --
>
next prev parent reply other threads:[~2019-07-13 1:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 5:47 [Question] Should direct reclaim time be bounded? Hillf Danton
2019-07-13 1:11 ` Mike Kravetz [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-07-11 15:44 Hillf Danton
2019-04-23 4:07 Mike Kravetz
2019-04-23 7:19 ` Michal Hocko
2019-04-23 16:39 ` Mike Kravetz
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
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=c39e7cb3-204c-c4e3-fb43-7a37d91c0ccb@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=hannes@cmpxchg.org \
--cc=hdanton@sina.com \
--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).