Re: REGRESSION: Performance regressions from switching anon_vma->lock to mutex

Hugh Dickins
2011-06-17T22:20:34Z

On Fri, 17 Jun 2011, Linus Torvalds wrote:
> On Fri, Jun 17, 2011 at 11:32 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > something like so I guess, completely untested etc..
>
> Having gone over it a bit more, I actually think I prefer to just
> special-case the allocation instead.
>
> We already have to drop the anon_vma lock for the "out of memory"
> case, and a slight re-organization of clone_anon_vma() makes it easy
> to just first try a NOIO allocation with the lock still held, and then
> if that fails do the "drop lock, retry, and hard-fail" case.
>
> IOW, something like the attached (on top of the patches already posted
> except for your memory reclaim thing)
>
> Hugh, does this fix the lockdep issue?

Yes, that fixed the lockdep issue, and ran nicely under load for an hour.

I agree that it's better to do this GFP_NOWAIT and fallback,
than trylock the anon_vma.

And I'm happy that you've still got that WARN_ON_ONCE(root) in: I do not
have a fluid mental model of the anon_vma_chains, get lost there; and
though it's obvious that we must have the same anon_vma->root going
down the same_anon_vma list, I could not put my finger on a killer
demonstration for why the same has to be true of the same_vma list.

But I've not seen your WARN_ON_ONCE fire, and it's hard to imagine
how there could be more than one root in the whole bundle of lists.

Hugh