Re: [PATCH 3/4] mm/vmscan: Attempt to migrate page in lieu of discard

From: Dave Hansen
Date: Fri Oct 18 2019 - 14:15:10 EST


On 10/17/19 10:30 AM, Yang Shi wrote:
>> + if (!PageHuge(page)) {
>> + int rc = migrate_demote_mapping(page);
>> +
>> + /*
>> + * -ENOMEM on a THP may indicate either migration is
>> + * unsupported or there was not enough contiguous
>> + * space. Split the THP into base pages and retry the
>> + * head immediately. The tail pages will be considered
>> + * individually within the current loop's page list.
>> + */
>> + if (rc == -ENOMEM && PageTransHuge(page) &&
>> + !split_huge_page_to_list(page, page_list))
>> + rc = migrate_demote_mapping(page);
> I recalled when Keith posted the patch at the first time, I raised
> question about why not just migrating THP in a whole? The
> migrate_pages() could handle this. If it fails, it just fallbacks to
> base page.

There's a pair of migrate_demote_mapping()s in there. I expected that
the first will migrate the whole THP and the second plus the split is
only used if fails the whole migration.

Am I reading it wrong?