diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-20 16:24:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-21 08:49:21 -0700 |
commit | 297c5eee372478fc32fec5fe8eed711eedb13f3d (patch) | |
tree | 18415eae0833ff4767943f985900524d6b1d73f1 /mm/nommu.c | |
parent | 36423a5ed5e4ea95ceedb68fad52965033e11639 (diff) | |
download | linux-297c5eee372478fc32fec5fe8eed711eedb13f3d.tar.gz linux-297c5eee372478fc32fec5fe8eed711eedb13f3d.tar.bz2 linux-297c5eee372478fc32fec5fe8eed711eedb13f3d.zip |
mm: make the vma list be doubly linked
It's a really simple list, and several of the users want to go backwards
in it to find the previous vma. So rather than have to look up the
previous entry with 'find_vma_prev()' or something similar, just make it
doubly linked instead.
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index efa9a380335e..88ff091eb07a 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -604,7 +604,7 @@ static void protect_vma(struct vm_area_struct *vma, unsigned long flags) */ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma) { - struct vm_area_struct *pvma, **pp; + struct vm_area_struct *pvma, **pp, *next; struct address_space *mapping; struct rb_node **p, *parent; @@ -664,8 +664,11 @@ static void add_vma_to_mm(struct mm_struct *mm, struct vm_area_struct *vma) break; } - vma->vm_next = *pp; + next = *pp; *pp = vma; + vma->vm_next = next; + if (next) + next->vm_prev = vma; } /* |