Skip to content

Commit

Permalink
mm/mmap.c: remove the first mapping check
Browse files Browse the repository at this point in the history
Remove the first mapping check for vma_link.  Move the mutex_lock into the
braces when vma->vm_file is true.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Huang Shijie authored and Linus Torvalds committed Jun 4, 2014
1 parent 2329d37 commit 64ac494
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,10 @@ static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma,
{
struct address_space *mapping = NULL;

if (vma->vm_file)
if (vma->vm_file) {
mapping = vma->vm_file->f_mapping;

if (mapping)
mutex_lock(&mapping->i_mmap_mutex);
}

__vma_link(mm, vma, prev, rb_link, rb_parent);
__vma_link_file(vma);
Expand Down

0 comments on commit 64ac494

Please sign in to comment.