aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRajesh Venkatasubramanian <vrajesh@umich.edu>2004-08-22 22:56:55 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-22 22:56:55 -0700
commite66c6753333b9c2b1cf5daf0b73814b5fdb09c41 (patch)
tree9cbeae75fc154c6aedd7a291565f8541e44ae509 /mm
parent2caed7c7a77f4529255cc218faaf70390f3d0001 (diff)
downloadhistory-e66c6753333b9c2b1cf5daf0b73814b5fdb09c41.tar.gz
[PATCH] prio_tree: kill vma_prio_tree_init()
vma_prio_tree_insert() relies on the fact, that vma was vma_prio_tree_init()'ed. Content of vma->shared should be considered undefined, until this vma is inserted into i_mmap/i_mmap_nonlinear. It's better to do proper initialization in vma_prio_tree_add/insert. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Rajesh Venkatasubramanian <vrajesh@umich.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/fremap.c4
-rw-r--r--mm/mmap.c10
-rw-r--r--mm/prio_tree.c5
3 files changed, 8 insertions, 11 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index dc64dd9dbe0bec..fcd6158271598f 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -220,9 +220,7 @@ asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
flush_dcache_mmap_lock(mapping);
vma->vm_flags |= VM_NONLINEAR;
vma_prio_tree_remove(vma, &mapping->i_mmap);
- vma_prio_tree_init(vma);
- list_add_tail(&vma->shared.vm_set.list,
- &mapping->i_mmap_nonlinear);
+ vma_nonlinear_insert(vma, &mapping->i_mmap_nonlinear);
flush_dcache_mmap_unlock(mapping);
spin_unlock(&mapping->i_mmap_lock);
}
diff --git a/mm/mmap.c b/mm/mmap.c
index 68ea8ab1f72fdf..3f7495c75228c2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -279,8 +279,7 @@ static inline void __vma_link_file(struct vm_area_struct *vma)
flush_dcache_mmap_lock(mapping);
if (unlikely(vma->vm_flags & VM_NONLINEAR))
- list_add_tail(&vma->shared.vm_set.list,
- &mapping->i_mmap_nonlinear);
+ vma_nonlinear_insert(vma, &mapping->i_mmap_nonlinear);
else
vma_prio_tree_insert(vma, &mapping->i_mmap);
flush_dcache_mmap_unlock(mapping);
@@ -449,11 +448,8 @@ again: remove_next = 1 + (end > next->vm_end);
}
if (root) {
- if (adjust_next) {
- vma_prio_tree_init(next);
+ if (adjust_next)
vma_prio_tree_insert(next, root);
- }
- vma_prio_tree_init(vma);
vma_prio_tree_insert(vma, root);
flush_dcache_mmap_unlock(mapping);
}
@@ -1489,7 +1485,6 @@ int split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
/* most fields are the same, copy all, and then fixup */
*new = *vma;
- vma_prio_tree_init(new);
if (new_below)
new->vm_end = addr;
@@ -1802,7 +1797,6 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (new_vma) {
*new_vma = *vma;
- vma_prio_tree_init(new_vma);
pol = mpol_copy(vma_policy(vma));
if (IS_ERR(pol)) {
kmem_cache_free(vm_area_cachep, new_vma);
diff --git a/mm/prio_tree.c b/mm/prio_tree.c
index 6cd41a831e2d71..7608735b39b811 100644
--- a/mm/prio_tree.c
+++ b/mm/prio_tree.c
@@ -538,6 +538,9 @@ void vma_prio_tree_add(struct vm_area_struct *vma, struct vm_area_struct *old)
BUG_ON(RADIX_INDEX(vma) != RADIX_INDEX(old));
BUG_ON(HEAP_INDEX(vma) != HEAP_INDEX(old));
+ vma->shared.vm_set.head = NULL;
+ vma->shared.vm_set.parent = NULL;
+
if (!old->shared.vm_set.parent)
list_add(&vma->shared.vm_set.list,
&old->shared.vm_set.list);
@@ -557,6 +560,8 @@ void vma_prio_tree_insert(struct vm_area_struct *vma,
struct prio_tree_node *ptr;
struct vm_area_struct *old;
+ vma->shared.vm_set.head = NULL;
+
ptr = prio_tree_insert(root, &vma->shared.prio_tree_node);
if (ptr != &vma->shared.prio_tree_node) {
old = prio_tree_entry(ptr, struct vm_area_struct,