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

Linus Torvalds
2011-06-16T21:33:32Z

On Thu, Jun 16, 2011 at 2:06 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Jun 16, 2011 at 2:05 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> This patch is UNTESTED!
>
> It was also UNATTACHED!

Hmm. And it doesn't work. We deadlock when we free the anon_vma
because the *freeing* path wants to take the anon_vma lock. See that
horrid code in anon_vma_free().

So now we now hold the root over the whole series of frees, and get an
instant deadlock.

We also can happen to free the root anon_vma before we release the
lock in it, which is another slight problem ;)

So the unlink_anon_vmas() case is actually much more complicated than
the clone case.

In other words, just forget that second patch. I'll have to think about it.

Linus