struct vm_area_struct *vm_area_alloc(struct mm_struct *);
 struct vm_area_struct *vm_area_dup(struct vm_area_struct *);
 void vm_area_free(struct vm_area_struct *);
+/* Use only if VMA has no other users */
+void __vm_area_free(struct vm_area_struct *vma);
 
 #ifndef CONFIG_MMU
 extern struct rb_root nommu_region_tree;
 
        return new;
 }
 
-static void __vm_area_free(struct vm_area_struct *vma)
+void __vm_area_free(struct vm_area_struct *vma)
 {
        free_anon_vma_name(vma);
        kmem_cache_free(vm_area_cachep, vma);
 
 /*
  * Close a vm structure and free it.
  */
-static void remove_vma(struct vm_area_struct *vma)
+static void remove_vma(struct vm_area_struct *vma, bool unreachable)
 {
        might_sleep();
        if (vma->vm_ops && vma->vm_ops->close)
        if (vma->vm_file)
                fput(vma->vm_file);
        mpol_put(vma_policy(vma));
-       vm_area_free(vma);
+       if (unreachable)
+               __vm_area_free(vma);
+       else
+               vm_area_free(vma);
 }
 
 static inline struct vm_area_struct *vma_prev_limit(struct vma_iterator *vmi,
                if (vma->vm_flags & VM_ACCOUNT)
                        nr_accounted += nrpages;
                vm_stat_account(mm, vma->vm_flags, -nrpages);
-               remove_vma(vma);
+               remove_vma(vma, false);
        }
        vm_unacct_memory(nr_accounted);
        validate_mm(mm);
        do {
                if (vma->vm_flags & VM_ACCOUNT)
                        nr_accounted += vma_pages(vma);
-               remove_vma(vma);
+               remove_vma(vma, true);
                count++;
                cond_resched();
        } while ((vma = mas_find(&mas, ULONG_MAX)) != NULL);