Re: [PATCH] mm: prevent mmap_cache race in find_vma()

2013-04-04 Thread Paul E. McKenney
On Thu, Apr 04, 2013 at 12:01:52PM -0700, Hugh Dickins wrote: > On Thu, 4 Apr 2013, Linus Torvalds wrote: > > On Thu, Apr 4, 2013 at 11:35 AM, Hugh Dickins wrote: > > > > > > find_vma() can be called by multiple threads with read lock > > > held on mm->mmap_sem and any of them can update mm->mmap_

Re: [PATCH] mm: prevent mmap_cache race in find_vma()

2013-04-04 Thread Linus Torvalds
On Thu, Apr 4, 2013 at 12:01 PM, Hugh Dickins wrote: > > When Paul reminded us of it yesterday, I came to wonder if actually > every use of ACCESS_ONCE in the read form should strictly be matched > by ACCESS_ONCE whenever modifying the location. > > My uneducated guess is that strictly it ought to

Re: [PATCH] mm: prevent mmap_cache race in find_vma()

2013-04-04 Thread Hugh Dickins
On Thu, 4 Apr 2013, Linus Torvalds wrote: > On Thu, Apr 4, 2013 at 11:35 AM, Hugh Dickins wrote: > > > > find_vma() can be called by multiple threads with read lock > > held on mm->mmap_sem and any of them can update mm->mmap_cache. > > Prevent compiler from re-fetching mm->mmap_cache, because oth

Re: [PATCH] mm: prevent mmap_cache race in find_vma()

2013-04-04 Thread Linus Torvalds
On Thu, Apr 4, 2013 at 11:35 AM, Hugh Dickins wrote: > > find_vma() can be called by multiple threads with read lock > held on mm->mmap_sem and any of them can update mm->mmap_cache. > Prevent compiler from re-fetching mm->mmap_cache, because other > readers could update it in the meantime: Ack.

[PATCH] mm: prevent mmap_cache race in find_vma()

2013-04-04 Thread Hugh Dickins
From: Jan Stancek find_vma() can be called by multiple threads with read lock held on mm->mmap_sem and any of them can update mm->mmap_cache. Prevent compiler from re-fetching mm->mmap_cache, because other readers could update it in the meantime: thread 1