diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index c1c1d6d8c22b..02fc6b1047b0 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -901,9 +901,23 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp, | |||
901 | } | 901 | } |
902 | 902 | ||
903 | if (unlikely(is_vm_hugetlb_page(vma))) { | 903 | if (unlikely(is_vm_hugetlb_page(vma))) { |
904 | unmap_hugepage_range(vma, start, end, NULL); | 904 | /* |
905 | zap_work -= (end - start) / | 905 | * It is undesirable to test vma->vm_file as it |
906 | * should be non-null for valid hugetlb area. | ||
907 | * However, vm_file will be NULL in the error | ||
908 | * cleanup path of do_mmap_pgoff. When | ||
909 | * hugetlbfs ->mmap method fails, | ||
910 | * do_mmap_pgoff() nullifies vma->vm_file | ||
911 | * before calling this function to clean up. | ||
912 | * Since no pte has actually been setup, it is | ||
913 | * safe to do nothing in this case. | ||
914 | */ | ||
915 | if (vma->vm_file) { | ||
916 | unmap_hugepage_range(vma, start, end, NULL); | ||
917 | zap_work -= (end - start) / | ||
906 | pages_per_huge_page(hstate_vma(vma)); | 918 | pages_per_huge_page(hstate_vma(vma)); |
919 | } | ||
920 | |||
907 | start = end; | 921 | start = end; |
908 | } else | 922 | } else |
909 | start = unmap_page_range(*tlbp, vma, | 923 | start = unmap_page_range(*tlbp, vma, |