Re: anon-vma (and now filebacked-mappings too) mprotect vma merging [Re: 2.6.5-rc2-aa vma merging]

From: Andrea Arcangeli
Date: Sat Apr 03 2004 - 20:02:53 EST


On Sat, Apr 03, 2004 at 08:29:15PM +0100, Hugh Dickins wrote:
> I liked Andrew's vma->page_table_lock suggestion, was imagining we

vma->page_table_lock cannot help you with anonmm, the rbtree is global,
for that you still need a mm-wide lock with anonmm. I serialize
read/write the rbtree only with the mmap_sem, you cannot.

vma->page_table_lock helps _only_ in the pagetable scanning: so only
_after_ nuking the global page_table_lock like I can do thanks to
anon_vma. you cannot drop the mm-wide page_table_lock with anonmm.
vma->page_table_lock is a natural optimization for the anon-vma logic
instead (after fixing the mremap/truncate race ;).

To drop the page_table_lock during vma manipulations in anonmm (and so
to give a real sense to a vma->page_table_lock in anonmm) you could use
a down_read_trylock on the mm->mmap_sem, but that is not going to work
well: the mmap_sem can be taken during extended period of times
involving I/O, and you may never get it. BTW, now that the lookup on the
prio-tree is immediate the i_shared_sem has no reason anymore to be a
semaphore either, it should go back to a spinlock like in 2.4, like the
anon_vma is also protected by a spinlock.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/