On Mon, Oct 19, 2015 at 11:25:56PM +0200, Vlastimil Babka wrote: > >>>I think we need to have at lease WRITE_ONCE() everywhere we update > >>>vm_flags and READ_ONCE() where we read it without mmap_sem taken. > > It wouldn't hurt to check if seeing a stale value or using non-atomic RMW > can be a problem somewhere. In this case it's testing, not changing, so RMW > is not an issue. But the check shouldn't consider arbitrary changes made by > a potentially crazy compiler. > > >>Not a series I'll embark upon myself, > >>and the patch at hand doesn't make things worse. > > > >I think it does. > > So what's the alternative? Hm could we keep the trylock on mmap_sem under > pte lock? The ordering is wrong, but it's a trylock, so no danger of > deadlock? This patch is okay for now as it fixes bug. I mean more real bug than it introduces ;) But situation with locking around ->vm_flags is getting worse. ->mmap_sem doesn't serve it well. We need to come up with something better. -- Kirill A. Shutemov -- 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>