The patch titled Subject: mm/hmm: do not erase snapshot when a range is invalidated has been added to the -mm tree. Its filename is mm-hmm-do-not-erase-snapshot-when-a-range-is-invalidated.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hmm-do-not-erase-snapshot-when-a-range-is-invalidated.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hmm-do-not-erase-snapshot-when-a-range-is-invalidated.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jérôme Glisse <jglisse@xxxxxxxxxx> Subject: mm/hmm: do not erase snapshot when a range is invalidated Users of HMM might be using the snapshot information to do preparatory step like dma mapping pages to a device before checking for invalidation through hmm_vma_range_done() so do not erase that information and assume users will do the right thing. Link: http://lkml.kernel.org/r/20190129165428.3931-3-jglisse@xxxxxxxxxx Signed-off-by: Jérôme Glisse <jglisse@xxxxxxxxxx> Cc: Ralph Campbell <rcampbell@xxxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Christian König <christian.koenig@xxxxxxx> Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Felix Kuehling <Felix.Kuehling@xxxxxxx> Cc: Jason Gunthorpe <jgg@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hmm.c | 6 ------ 1 file changed, 6 deletions(-) --- a/mm/hmm.c~mm-hmm-do-not-erase-snapshot-when-a-range-is-invalidated +++ a/mm/hmm.c @@ -170,16 +170,10 @@ static int hmm_invalidate_range(struct h spin_lock(&hmm->lock); list_for_each_entry(range, &hmm->ranges, list) { - unsigned long addr, idx, npages; - if (update->end < range->start || update->start >= range->end) continue; range->valid = false; - addr = max(update->start, range->start); - idx = (addr - range->start) >> PAGE_SHIFT; - npages = (min(range->end, update->end) - addr) >> PAGE_SHIFT; - memset(&range->pfns[idx], 0, sizeof(*range->pfns) * npages); } spin_unlock(&hmm->lock); _ Patches currently in -mm which might be from jglisse@xxxxxxxxxx are mm-hmm-use-reference-counting-for-hmm-struct.patch mm-hmm-do-not-erase-snapshot-when-a-range-is-invalidated.patch mm-hmm-improve-and-rename-hmm_vma_get_pfns-to-hmm_range_snapshot.patch mm-hmm-improve-and-rename-hmm_vma_fault-to-hmm_range_fault.patch mm-hmm-improve-driver-api-to-work-and-wait-over-a-range.patch mm-hmm-add-default-fault-flags-to-avoid-the-need-to-pre-fill-pfns-arrays.patch mm-hmm-add-an-helper-function-that-fault-pages-and-map-them-to-a-device.patch mm-hmm-support-hugetlbfs-snap-shoting-faulting-and-dma-mapping.patch mm-hmm-allow-to-mirror-vma-of-a-file-on-a-dax-backed-filesystem.patch mm-hmm-add-helpers-for-driver-to-safely-take-the-mmap_sem.patch mm-mmu_notifier-contextual-information-for-event-triggering-invalidation-v2.patch mm-mmu_notifier-contextual-information-for-event-triggering-invalidation-v2-fix.patch