On Mon, Jan 18, 2021 at 11:39:08PM -0500, Pavel Tatashin wrote:
When pages are isolated in check_and_migrate_movable_pages() we skip compound number of pages at a time. However, as Jason noted, it is not necessary correct that pages[i] corresponds to the pages that we skipped. This is because it is possible that the addresses in this range had split_huge_pmd()/split_huge_pud(), and these functions do not update the compound page metadata.
The problem can be reproduced if something like this occurs:
- User faulted huge pages.
- split_huge_pmd() was called for some reason
- User has unmapped some sub-pages in the range
- User tries to longterm pin the addresses.
The resulting pages[i] might end-up having pages which are not compound size page aligned.
Fixes: aa712399c1e8 ("mm/gup: speed up check_and_migrate_cma_pages() on huge page")
Reported-by: Jason Gunthorpe jgg@nvidia.com
No new line after fixes
Signed-off-by: Pavel Tatashin pasha.tatashin@soleen.com mm/gup.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
Looks good
Reviewed-by: Jason Gunthorpe jgg@nvidia.com
Thanks, Jason