Skip to content

Commit

Permalink
nommu: remove a superfluous check of vm_region::vm_usage
Browse files Browse the repository at this point in the history
In split_vma(), there's no need to check if the VMA being split has a
region that's in use by more than one VMA because:

 (1) The preceding test prohibits splitting of non-anonymous VMAs and regions
     (eg: file or chardev backed VMAs).

 (2) Anonymous regions can't be mapped multiple times because there's no handle
     by which to refer to the already existing region.

 (3) If a VMA has previously been split, then the region backing it has also
     been split into two regions, each of usage 1.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Greg Ungerer <gerg@snapgear.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed Jan 16, 2010
1 parent 1e2ae59 commit 779c102
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,10 +1441,9 @@ int split_vma(struct mm_struct *mm, struct vm_area_struct *vma,

kenter("");

/* we're only permitted to split anonymous regions that have a single
* owner */
if (vma->vm_file ||
vma->vm_region->vm_usage != 1)
/* we're only permitted to split anonymous regions (these should have
* only a single usage on the region) */
if (vma->vm_file)
return -ENOMEM;

if (mm->map_count >= sysctl_max_map_count)
Expand Down

0 comments on commit 779c102

Please sign in to comment.