On Tue, Jun 06, 2017 at 06:58:36PM +0100, Will Deacon wrote: > When migrating a transparent hugepage, migrate_misplaced_transhuge_page > guards itself against a concurrent fastgup of the page by checking that > the page count is equal to 2 before and after installing the new pmd. > > If the page count changes, then the pmd is reverted back to the original > entry, however there is a small window where the new (possibly writable) > pmd is installed and the underlying page could be written by userspace. > Restoring the old pmd could therefore result in loss of data. > > This patch fixes the problem by freezing the page count whilst updating > the page tables, which protects against a concurrent fastgup without the > need to restore the old pmd in the failure case (since the page count can > no longer change under our feet). > > Cc: Mel Gorman <mgorman@xxxxxxx> > Signed-off-by: Will Deacon <will.deacon@xxxxxxx> Looks correct to me. Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>