On 2 Sep 2020, at 12:58, Ralph Campbell wrote:
A migrating transparent huge page has to already be unmapped. Otherwise,
the page could be modified while it is being copied to a new page and
data could be lost. The function __split_huge_pmd() checks for a PMD
migration entry before calling __split_huge_pmd_locked() leading one to
think that __split_huge_pmd_locked() can handle splitting a migrating PMD.
However, the code always increments the page->_mapcount and adjusts the
memory control group accounting assuming the page is mapped.
Also, if the PMD entry is a migration PMD entry, the call to
is_huge_zero_pmd(*pmd) is incorrect because it calls pmd_pfn(pmd) instead
of migration_entry_to_pfn(pmd_to_swp_entry(pmd)).
Fix these problems by checking for a PMD migration entry.
Signed-off-by: Ralph Campbell <rcampbell@xxxxxxxxxx>
Thanks for the fix. You can add Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
I think you also want to add the Fixes tag and cc stable.
Fixes 84c3fc4e9c56 (“mm: thp: check pmd migration entry in common path”)
cc: stable@xxxxxxxxxxxxxxx # 4.14+