On 04/25/2014 11:41 AM, Hugh Dickins wrote: > On Fri, 25 Apr 2014, Dave Hansen wrote: >> On 04/25/2014 05:01 AM, Hugh Dickins wrote: >>> Er, i_mmap_mutex. >>> >>> That's what unmap_mapping_range(), and page_mkclean()'s rmap_walk, >>> take to iterate over the file vmas. So perhaps there's no race at all >>> in the unmap_mapping_range() case. And easy (I imagine) to fix the >>> race in Dave's racewrite.c use of MADV_DONTNEED: untested patch below. >>> >>> But exit and munmap() don't take i_mmap_mutex: perhaps they should >>> when encountering a VM_SHARED vma (I believe VM_SHARED should be >>> peculiar to having vm_file set, but test both below because I don't >>> want to oops in some odd corner where a special vma is set up). >> >> Hey Hugh, >> >> Do you want some testing on this? > > Yes, please do: I just haven't gotten around to cloning the git > tree and trying it. It's quite likely that we shall go Linus's > way rather than this, but still useful to have the information > as to whether this way really is viable. Your patch works fine for the madvise() case. The effect appears the same as Linus's to my test case at least. I didn't test any unmaps or other creative uses of unmap_mapping_range(). -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>