[ofa-general] Re: [PATCH 08 of 11] anon-vma-rwsem
Andrea Arcangeli
andrea at qumranet.com
Wed May 7 18:26:56 PDT 2008
On Wed, May 07, 2008 at 06:02:49PM -0700, Linus Torvalds wrote:
> You replace mm_lock() with the sequence that Andrew gave you (and I
> described):
>
> spin_lock(&global_lock)
> .. get all locks UNORDERED ..
> spin_unlock(&global_lock)
>
> and you're now done. You have your "mm_lock()" (which still needs to be
> renamed - it should be a "mmu_notifier_lock()" or something like that),
> but you don't need the insane sorting. At most you apparently need a way
> to recognize duplicates (so that you don't deadlock on yourself), which
> looks like a simple bit-per-vma.
>
> The global lock doesn't protect any data structures itself - it just
> protects two of these mm_lock() functions from ABBA'ing on each other!
I thought the thing to remove was the "get all locks". I didn't
realize the major problem was only the sorting of the array.
I'll add the global lock, it's worth it as it drops the worst case
number of steps by log(65536) times. Furthermore surely two concurrent
mm_notifier_lock will run faster as it'll decrease the cacheline
collisions. Since you ask to call it mmu_notifier_lock I'll also move
it to mmu_notifier.[ch] as consequence.
More information about the general
mailing list