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.
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?
Thanks.