On Mon, 2012-06-18 at 18:05 -0400, Rik van Riel wrote: > @@ -473,11 +524,17 @@ __vma_unlink(struct mm_struct *mm, struct vm_area_struct *vma, > struct vm_area_struct *prev) > { > struct vm_area_struct *next = vma->vm_next; > + struct rb_node *deepest; > > prev->vm_next = next; > - if (next) > + if (next) { > next->vm_prev = prev; > + adjust_free_gap(next); > + } > + deepest = rb_augment_erase_begin(&vma->vm_rb); > rb_erase(&vma->vm_rb, &mm->mm_rb); > + rb_augment_erase_end(deepest, vma_rb_augment_cb, NULL); > + > if (mm->mmap_cache == vma) > mm->mmap_cache = prev; > } > @@ -1933,7 +2002,10 @@ detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma, > insertion_point = (prev ? &prev->vm_next : &mm->mmap); > vma->vm_prev = NULL; > do { > + struct rb_node *deepest; > + deepest = rb_augment_erase_begin(&vma->vm_rb); > rb_erase(&vma->vm_rb, &mm->mm_rb); > + rb_augment_erase_end(deepest, vma_rb_augment_cb, NULL); --- include/linux/rbtree.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 033b507..07c5843 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h @@ -155,6 +155,14 @@ extern struct rb_node *rb_augment_erase_begin(struct rb_node *node); extern void rb_augment_erase_end(struct rb_node *node, rb_augment_f func, void *data); +static inline void rb_augment_erase(struct rb_node *node, struct rb_root *root, + rb_augment_f func, void *data) +{ + struct rb_node *deepest = rb_augment_erase_begin(node); + rb_erase(node, root); + rb_augment_erase_end(deepest, func, data); +} + /* Find logical next and previous nodes in a tree */ extern struct rb_node *rb_next(const struct rb_node *); extern struct rb_node *rb_prev(const struct rb_node *); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href