Commit 6c0993a0 authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] Cross-reference nommu VMAs with mappings

The attached patch includes prio-tree support and adds cross-referencing of
VMAs with address spaces back in, as is done under normal MMU Linux.
Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f5f20ef0
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
mmu-y := nommu.o mmu-y := nommu.o
mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \ mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
vmalloc.o prio_tree.o vmalloc.o
obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
page_alloc.o page-writeback.o pdflush.o \ page_alloc.o page-writeback.o pdflush.o \
readahead.o slab.o swap.o truncate.o vmscan.o \ readahead.o slab.o swap.o truncate.o vmscan.o \
$(mmu-y) prio_tree.o $(mmu-y)
obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o
obj-$(CONFIG_HUGETLBFS) += hugetlb.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o
......
...@@ -51,10 +51,6 @@ DECLARE_RWSEM(nommu_vma_sem); ...@@ -51,10 +51,6 @@ DECLARE_RWSEM(nommu_vma_sem);
struct vm_operations_struct generic_file_vm_ops = { struct vm_operations_struct generic_file_vm_ops = {
}; };
void __init prio_tree_init(void)
{
}
/* /*
* Handle all mappings that got truncated by a "truncate()" * Handle all mappings that got truncated by a "truncate()"
* system call. * system call.
...@@ -322,6 +318,15 @@ static void add_nommu_vma(struct vm_area_struct *vma) ...@@ -322,6 +318,15 @@ static void add_nommu_vma(struct vm_area_struct *vma)
struct rb_node **p = &nommu_vma_tree.rb_node; struct rb_node **p = &nommu_vma_tree.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
/* add the VMA to the mapping */
if (vma->vm_file) {
mapping = vma->vm_file->f_mapping;
flush_dcache_mmap_lock(mapping);
vma_prio_tree_insert(vma, &mapping->i_mmap);
flush_dcache_mmap_unlock(mapping);
}
/* add the VMA to the master list */ /* add the VMA to the master list */
while (*p) { while (*p) {
parent = *p; parent = *p;
...@@ -356,6 +361,15 @@ static void delete_nommu_vma(struct vm_area_struct *vma) ...@@ -356,6 +361,15 @@ static void delete_nommu_vma(struct vm_area_struct *vma)
{ {
struct address_space *mapping; struct address_space *mapping;
/* remove the VMA from the mapping */
if (vma->vm_file) {
mapping = vma->vm_file->f_mapping;
flush_dcache_mmap_lock(mapping);
vma_prio_tree_remove(vma, &mapping->i_mmap);
flush_dcache_mmap_unlock(mapping);
}
/* remove from the master list */ /* remove from the master list */
rb_erase(&vma->vm_rb, &nommu_vma_tree); rb_erase(&vma->vm_rb, &nommu_vma_tree);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment