aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/mmap.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index e1780266ac7d..eeefe19a0fac 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1603,35 +1603,23 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr)
1603} 1603}
1604#endif 1604#endif
1605 1605
1606/* Normal function to fix up a mapping
1607 * This function is the default for when an area has no specific
1608 * function. This may be used as part of a more specific routine.
1609 *
1610 * By the time this function is called, the area struct has been
1611 * removed from the process mapping list.
1612 */
1613static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma)
1614{
1615 long nrpages = vma_pages(vma);
1616
1617 mm->total_vm -= nrpages;
1618 if (vma->vm_flags & VM_LOCKED)
1619 mm->locked_vm -= nrpages;
1620 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
1621 remove_vm_struct(vma);
1622}
1623
1624/* 1606/*
1625 * Update the VMA and inode share lists. 1607 * Ok - we have the memory areas we should free on the vma list,
1626 *
1627 * Ok - we have the memory areas we should free on the 'free' list,
1628 * so release them, and do the vma updates. 1608 * so release them, and do the vma updates.
1609 *
1610 * Called with the mm semaphore held.
1629 */ 1611 */
1630static void unmap_vma_list(struct mm_struct *mm, struct vm_area_struct *vma) 1612static void remove_vma_list(struct mm_struct *mm, struct vm_area_struct *vma)
1631{ 1613{
1632 do { 1614 do {
1633 struct vm_area_struct *next = vma->vm_next; 1615 struct vm_area_struct *next = vma->vm_next;
1634 unmap_vma(mm, vma); 1616 long nrpages = vma_pages(vma);
1617
1618 mm->total_vm -= nrpages;
1619 if (vma->vm_flags & VM_LOCKED)
1620 mm->locked_vm -= nrpages;
1621 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
1622 remove_vm_struct(vma);
1635 vma = next; 1623 vma = next;
1636 } while (vma); 1624 } while (vma);
1637 validate_mm(mm); 1625 validate_mm(mm);
@@ -1799,7 +1787,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
1799 unmap_region(mm, vma, prev, start, end); 1787 unmap_region(mm, vma, prev, start, end);
1800 1788
1801 /* Fix up all other VM information */ 1789 /* Fix up all other VM information */
1802 unmap_vma_list(mm, vma); 1790 remove_vma_list(mm, vma);
1803 1791
1804 return 0; 1792 return 0;
1805} 1793}