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

From: Andrew Morton
Date: Sat Apr 03 2004 - 20:15:01 EST


Andrea Arcangeli <andrea@xxxxxxx> wrote:
>
> 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.

That change was made for scheduling latency reasons, mainly due to huge
pagetable walks in zap_page_range():

i_shared_lock is held for a very long time during vmtruncate() and
causes high scheduling latencies when truncating a file which is
mmapped. I've seen 100 milliseconds.

So turn it into a semaphore. It nests inside mmap_sem. This
change is also needed by the shared pagetable patch, which needs to
unshare pte's on the vmtruncate path - lots of pagetable pages need to
be allocated and they are using __GFP_WAIT.

If we no longer hold that lock during pte takedown then sure, it would
be better if we had a spinlock in there.

-
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/