The patch titled hugetlb: fix prio tree lookup has been removed from the -mm tree. Its filename was hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed-fix.patch This patch was dropped because it was folded into hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed.patch The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: hugetlb: fix prio tree lookup From: Mel Gorman <mel@xxxxxxxxx> I spoke too soon. This is a fix to patch 3/3. If a child unmaps the start of the VMA, the start address is different and that is perfectly legimite making the BUG_ON check bogus and should be removed. While page cache lookups are in HPAGE_SIZE, the vma->vm_pgoff is in PAGE_SIZE units, not HPAGE_SIZE. The offset calculation needs to be in PAGE_SIZE units to find other VMAs that are mapping the same range of pages. This patch fixes the offset calculation and adds an explanation comment as to why it is different from a page cache lookup. Credit goes to Johannes Weiner for spotting the bogus BUG_ON on IRC which led to the discovery of the faulty offset calculation. Signed-off-by: Mel Gorman <mel@xxxxxxxxx> Acked-by: Adam Litke <agl@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxxx> Cc: Andy Whitcroft <apw@xxxxxxxxxxxx> Cc: William Lee Irwin III <wli@xxxxxxxxxxxxxx> Cc: Hugh Dickins <hugh@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff -puN mm/hugetlb.c~hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed-fix mm/hugetlb.c --- a/mm/hugetlb.c~hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed-fix +++ a/mm/hugetlb.c @@ -1035,14 +1035,18 @@ int unmap_ref_private(struct mm_struct * { struct vm_area_struct *iter_vma; struct address_space *mapping; - pgoff_t pgoff = ((address - vma->vm_start) >> HPAGE_SHIFT) - + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT)); struct prio_tree_iter iter; + pgoff_t pgoff; + /* + * vm_pgoff is in PAGE_SIZE units, hence the different calculation + * from page cache lookup which is in HPAGE_SIZE units. + */ + pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + + (vma->vm_pgoff >> PAGE_SHIFT); mapping = (struct address_space *)page_private(page); - vma_prio_tree_foreach(iter_vma, &iter, &mapping->i_mmap, pgoff, pgoff) { - BUG_ON(vma->vm_start != iter_vma->vm_start); + vma_prio_tree_foreach(iter_vma, &iter, &mapping->i_mmap, pgoff, pgoff) { /* Do not unmap the current VMA */ if (iter_vma == vma) continue; _ Patches currently in -mm which might be from mel@xxxxxxxxx are origin.patch mm-add-a-basic-debugging-framework-for-memory-initialisation.patch mm-verify-the-page-links-and-memory-model.patch mm-make-defensive-checks-around-pfn-values-registered-for-memory-usage.patch mm-print-out-the-zonelists-on-request-for-manual-verification.patch mm-move-bootmem-descriptors-definition-to-a-single-place.patch mm-fix-free_all_bootmem_core-alignment-check.patch mm-normalize-internal-argument-passing-of-bootmem-data.patch mm-unexport-__alloc_bootmem_core.patch page-allocator-inlnie-some-__alloc_pages-wrappers.patch hugetlb-move-hugetlb_acct_memory.patch hugetlb-reserve-huge-pages-for-reliable-map_private-hugetlbfs-mappings-until-fork.patch hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed.patch hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed-fix.patch hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed-build-fix.patch hugetlb-guarantee-that-cow-faults-for-a-process-that-called-mmapmap_private-on-hugetlbfs-will-succeed-align-faulting-address-to-a-hugepage-boundary-before-unmapping.patch huge-page-private-reservation-review-cleanups.patch huge-page-private-reservation-review-cleanups-fix.patch mm-record-map_noreserve-status-on-vmas-and-fix-small-page-mprotect-reservations.patch hugetlb-move-reservation-region-support-earlier.patch hugetlb-allow-huge-page-mappings-to-be-created-without-reservations.patch hugetlb-allow-huge-page-mappings-to-be-created-without-reservations-cleanups.patch hugetlb-reservations-fix-hugetlb-map_private-reservations-across-vma-splits-v2.patch mm-remove-mm_init-compilation-dependency-on-config_debug_memory_init.patch mm-create-sys-kernel-mm.patch mm-create-sys-kernel-mm-fix.patch hugetlb-new-sysfs-interface-hugetlb-hang-off-of-sys-kernel-mm-rather-than-sys-kernel.patch hugetlb-new-sysfs-interface-hugetlb-remove-config_sysfs-dependency.patch hugetlb-fix-race-when-reading-proc-meminfo.patch hugetlb-fix-a-hugepage-reservation-check-for-map_shared.patch hugetlb-quota-is-not-freed-for-unused-reserved-private-huge-pages.patch mm-add-alloc_pages_exact-and-free_pages_exact.patch memory-hotplugallocate-usemap-on-the-section-with-pgdat-take-4.patch memory-hotplug-add-sysfs-removable-attribute-for-hotplug-memory-remove.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html