diff options
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 2454d39dc068..e5318f8efde5 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -804,17 +804,15 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma) | |||
804 | struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) | 804 | struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) |
805 | { | 805 | { |
806 | struct vm_area_struct *vma; | 806 | struct vm_area_struct *vma; |
807 | struct rb_node *n = mm->mm_rb.rb_node; | ||
808 | 807 | ||
809 | /* check the cache first */ | 808 | /* check the cache first */ |
810 | vma = mm->mmap_cache; | 809 | vma = mm->mmap_cache; |
811 | if (vma && vma->vm_start <= addr && vma->vm_end > addr) | 810 | if (vma && vma->vm_start <= addr && vma->vm_end > addr) |
812 | return vma; | 811 | return vma; |
813 | 812 | ||
814 | /* trawl the tree (there may be multiple mappings in which addr | 813 | /* trawl the list (there may be multiple mappings in which addr |
815 | * resides) */ | 814 | * resides) */ |
816 | for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { | 815 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
817 | vma = rb_entry(n, struct vm_area_struct, vm_rb); | ||
818 | if (vma->vm_start > addr) | 816 | if (vma->vm_start > addr) |
819 | return NULL; | 817 | return NULL; |
820 | if (vma->vm_end > addr) { | 818 | if (vma->vm_end > addr) { |
@@ -854,7 +852,6 @@ static struct vm_area_struct *find_vma_exact(struct mm_struct *mm, | |||
854 | unsigned long len) | 852 | unsigned long len) |
855 | { | 853 | { |
856 | struct vm_area_struct *vma; | 854 | struct vm_area_struct *vma; |
857 | struct rb_node *n = mm->mm_rb.rb_node; | ||
858 | unsigned long end = addr + len; | 855 | unsigned long end = addr + len; |
859 | 856 | ||
860 | /* check the cache first */ | 857 | /* check the cache first */ |
@@ -862,10 +859,9 @@ static struct vm_area_struct *find_vma_exact(struct mm_struct *mm, | |||
862 | if (vma && vma->vm_start == addr && vma->vm_end == end) | 859 | if (vma && vma->vm_start == addr && vma->vm_end == end) |
863 | return vma; | 860 | return vma; |
864 | 861 | ||
865 | /* trawl the tree (there may be multiple mappings in which addr | 862 | /* trawl the list (there may be multiple mappings in which addr |
866 | * resides) */ | 863 | * resides) */ |
867 | for (n = rb_first(&mm->mm_rb); n; n = rb_next(n)) { | 864 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
868 | vma = rb_entry(n, struct vm_area_struct, vm_rb); | ||
869 | if (vma->vm_start < addr) | 865 | if (vma->vm_start < addr) |
870 | continue; | 866 | continue; |
871 | if (vma->vm_start > addr) | 867 | if (vma->vm_start > addr) |