From: Vlastimil Babka <vbabka@suse.cz>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Minchan Kim <minchan@kernel.org>, Mel Gorman <mgorman@suse.de>,
Michal Nazarewicz <mina86@mina86.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Christoph Lameter <cl@linux.com>, Rik van Riel <riel@redhat.com>,
David Rientjes <rientjes@google.com>
Subject: Re: [PATCH 5/5] mm, compaction: more focused lru and pcplists draining
Date: Thu, 13 Nov 2014 13:47:08 +0100 [thread overview]
Message-ID: <5464A84C.1040903@suse.cz> (raw)
In-Reply-To: <20141104003733.GB8412@js1304-P5Q-DELUXE>
On 11/04/2014 01:37 AM, Joonsoo Kim wrote:
> On Mon, Nov 03, 2014 at 09:12:33AM +0100, Vlastimil Babka wrote:
>> On 10/27/2014 08:41 AM, Joonsoo Kim wrote:
>>> On Tue, Oct 07, 2014 at 05:33:39PM +0200, Vlastimil Babka wrote:
>>>
>>> And, I wonder why last_migrated_pfn is set after isolate_migratepages().
>>
>> Not sure I understand your question. With the mistake above, it
>> cannot currently be set at the point isolate_migratepages() is
>> called, so you might question the goto check_drain in the
>> ISOLATE_NONE case, if that's what you are wondering about.
>>
>> When I correct that, it might be set when COMPACT_CLUSTER_MAX pages
>> are isolated and migrated the middle of a pageblock, and then the
>> rest of the pageblock contains no pages that could be isolated, so
>> the last isolate_migratepages() attempt in the pageblock returns
>> with ISOLATE_NONE. Still there were some migrations that produced
>> free pages that should be drained at that point.
>
> To clarify my question, I attach psuedo code that I thought correct.
Sorry for the late reply.
> static int compact_zone()
> {
> unsigned long last_migrated_pfn = 0;
>
> ...
>
> compaction_suitable();
>
> ...
>
> while (compact_finished()) {
> if (!last_migrated_pfn)
> last_migrated_pfn = cc->migrate_pfn - 1;
>
> isolate_migratepages();
> switch case
> migrate_pages();
> ...
>
> check_drain: (at the end of loop)
> do flush and reset last_migrated_pfn if needed
> }
> }
>
> We should record last_migrated_pfn before isolate_migratepages() and
> then compare it with cc->migrate_pfn after isolate_migratepages() to
> know if we moved away from the previous cc->order aligned block.
> Am I missing something?
What about this scenario, with pageblock order:
- record cc->migrate_pfn pointing to pageblock X
- isolate_migratepages() skips the pageblock due to e.g. skip bit, or
the pageblock being a THP already...
- loop to pageblock X+1, last_migrated_pfn is still set to pfn of
pageblock X (more precisely the pfn is (X << pageblock_order) - 1 per
your code, but doesn't matter)
- isolate_migratepages isolates something, but ends up somewhere in the
middle of pageblock due to COMPACT_CLUSTER_MAX
- cc->migrate_pfn points to pageblock X+1 (plus some pages it scanned)
- so it will decide that it has fully migrated pageblock X and it's time
to drain. But the drain is most likely useless - we didn't migrate
anything in pageblock X, we skipped it. And in X+1 we didn't migrate
everything yet, so we should drain only after finishing the other part
of the pageblock.
In short, "last_migrated_pfn" is not "last position of migrate scanner"
but "last block where we *actually* migrated".
I think if you would try to fix the scenario above, you would end up
with something like my patch :)
Vlastimil
> Thanks.
>
--
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>
next prev parent reply other threads:[~2014-11-13 12:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 15:33 [PATCH 0/5] Further compaction tuning Vlastimil Babka
2014-10-07 15:33 ` [PATCH 1/5] mm, compaction: pass classzone_idx and alloc_flags to watermark checking Vlastimil Babka
2014-10-20 15:45 ` Rik van Riel
2014-10-27 6:46 ` Joonsoo Kim
2014-10-27 9:11 ` Vlastimil Babka
2014-10-28 7:16 ` Joonsoo Kim
2014-10-29 13:51 ` Vlastimil Babka
2014-10-31 7:49 ` Joonsoo Kim
2014-11-14 8:52 ` Vlastimil Babka
2014-10-07 15:33 ` [PATCH 2/5] mm, compaction: simplify deferred compaction Vlastimil Babka
2014-10-15 22:32 ` Andrew Morton
2014-10-16 15:11 ` Vlastimil Babka
2014-10-07 15:33 ` [PATCH 3/5] mm, compaction: defer only on COMPACT_COMPLETE Vlastimil Babka
2014-10-20 15:18 ` Rik van Riel
2014-10-07 15:33 ` [PATCH 4/5] mm, compaction: always update cached scanner positions Vlastimil Babka
2014-10-20 15:26 ` Rik van Riel
2014-10-27 7:35 ` Joonsoo Kim
2014-10-27 9:39 ` Vlastimil Babka
2014-10-28 7:08 ` Joonsoo Kim
2014-10-31 15:53 ` Vlastimil Babka
2014-11-04 0:28 ` Joonsoo Kim
2014-11-14 8:57 ` Vlastimil Babka
2014-10-07 15:33 ` [PATCH 5/5] mm, compaction: more focused lru and pcplists draining Vlastimil Babka
2014-10-20 15:44 ` Rik van Riel
2014-10-27 7:41 ` Joonsoo Kim
2014-11-03 8:12 ` Vlastimil Babka
2014-11-04 0:37 ` Joonsoo Kim
2014-11-13 12:47 ` Vlastimil Babka [this message]
2014-11-14 7:05 ` Joonsoo Kim
2014-11-19 22:53 ` 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=5464A84C.1040903@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mina86@mina86.com \
--cc=minchan@kernel.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=riel@redhat.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).