Re: [patch] mm: fix anon_vma races

Linus Torvalds
2008-10-18T01:08:05Z

On Fri, 17 Oct 2008, Linus Torvalds wrote:
>
> So maybe a better patch would be as follows? It simplifies the whole thing
> by just always locking and unlocking the vma, whether it's newly allocated
> or not (and whether it then gets dropped as unnecessary or not).

Side note: it would be nicer if we had a "spin_lock_init_locked()", so
that we could avoid the more expensive "true lock" when doing the initial
allocation, but we don't. That said, the case of having to allocate a new
anon_vma _should_ be the rare one.

I dunno. Nick's approach of just depending on memory ordering for the list
update probably works too. Even if it's rather more subtle than I'd like.

Linus