The patch titled Subject: mm-migrate-optimize-migrate_vma_setup-for-holes-v2 has been removed from the -mm tree. Its filename was mm-migrate-optimize-migrate_vma_setup-for-holes-v2.patch This patch was dropped because it was folded into mm-migrate-optimize-migrate_vma_setup-for-holes.patch ------------------------------------------------------ From: Ralph Campbell <rcampbell@xxxxxxxxxx> Subject: mm-migrate-optimize-migrate_vma_setup-for-holes-v2 Do the same check for vma_is_anonymous() for pte_none(). Don't increment cpages if the page isn't migrating. Link: http://lkml.kernel.org/r/20200710194840.7602-2-rcampbell@xxxxxxxxxx Signed-off-by: Ralph Campbell <rcampbell@xxxxxxxxxx> Cc: Jerome Glisse <jglisse@xxxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Jason Gunthorpe <jgg@xxxxxxxxxxxx> Cc: "Bharata B Rao" <bharata@xxxxxxxxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/mm/migrate.c~mm-migrate-optimize-migrate_vma_setup-for-holes-v2 +++ a/mm/migrate.c @@ -2167,13 +2167,19 @@ static int migrate_vma_collect_hole(unsi { struct migrate_vma *migrate = walk->private; unsigned long addr; - unsigned long flags; /* Only allow populating anonymous memory. */ - flags = vma_is_anonymous(walk->vma) ? MIGRATE_PFN_MIGRATE : 0; + if (!vma_is_anonymous(walk->vma)) { + for (addr = start; addr < end; addr += PAGE_SIZE) { + migrate->src[migrate->npages] = 0; + migrate->dst[migrate->npages] = 0; + migrate->npages++; + } + return 0; + } for (addr = start; addr < end; addr += PAGE_SIZE) { - migrate->src[migrate->npages] = flags; + migrate->src[migrate->npages] = MIGRATE_PFN_MIGRATE; migrate->dst[migrate->npages] = 0; migrate->npages++; migrate->cpages++; @@ -2264,8 +2270,10 @@ again: pte = *ptep; if (pte_none(pte)) { - mpfn = MIGRATE_PFN_MIGRATE; - migrate->cpages++; + if (vma_is_anonymous(vma)) { + mpfn = MIGRATE_PFN_MIGRATE; + migrate->cpages++; + } goto next; } _ Patches currently in -mm which might be from rcampbell@xxxxxxxxxx are mm-migrate-optimize-migrate_vma_setup-for-holes.patch mm-migrate-add-migrate-shared-test-for-migrate_vma_.patch