Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c0b3814 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds
Browse files

[PATCH] mm: remove_vma_list consolidation



unmap_vma doesn't amount to much, let's put it inside unmap_vma_list.  Except
it doesn't unmap anything, unmap_region just did the unmapping: rename it to
remove_vma_list.

Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ab50b8ed
Loading
Loading
Loading
Loading
+12 −24
Original line number Diff line number Diff line
@@ -1603,15 +1603,16 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr)
}
#endif

/* Normal function to fix up a mapping
 * This function is the default for when an area has no specific
 * function.  This may be used as part of a more specific routine.
/*
 * Ok - we have the memory areas we should free on the vma list,
 * so release them, and do the vma updates.
 *
 * By the time this function is called, the area struct has been
 * removed from the process mapping list.
 * Called with the mm semaphore held.
 */
static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma)
static void remove_vma_list(struct mm_struct *mm, struct vm_area_struct *vma)
{
	do {
		struct vm_area_struct *next = vma->vm_next;
		long nrpages = vma_pages(vma);

		mm->total_vm -= nrpages;
@@ -1619,19 +1620,6 @@ static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma)
			mm->locked_vm -= nrpages;
		vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
		remove_vm_struct(vma);
}

/*
 * Update the VMA and inode share lists.
 *
 * Ok - we have the memory areas we should free on the 'free' list,
 * so release them, and do the vma updates.
 */
static void unmap_vma_list(struct mm_struct *mm, struct vm_area_struct *vma)
{
	do {
		struct vm_area_struct *next = vma->vm_next;
		unmap_vma(mm, vma);
		vma = next;
	} while (vma);
	validate_mm(mm);
@@ -1799,7 +1787,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
	unmap_region(mm, vma, prev, start, end);

	/* Fix up all other VM information */
	unmap_vma_list(mm, vma);
	remove_vma_list(mm, vma);

	return 0;
}