On Tue, 26 Aug 2014, Cyrill Gorcunov wrote: > On Mon, Aug 25, 2014 at 09:45:34PM -0700, Hugh Dickins wrote: > > > > Hmm. For a long time I thought you were fixing another important bug > > with down_write, since we "always" use down_write to modify vm_flags. > > > > But now I'm realizing that if this is the _only_ place which modifies > > vm_flags with down_read, then it's "probably" safe. I've a vague > > feeling that this was discussed before - is that so, Cyrill? > > Well, as far as I remember we were not talking before about vm_flags > and read-lock in this function, maybe it was on some unrelated lkml thread > without me CC'ed? Until I miss something obvious using read-lock here > for vm_flags modification should be safe, since the only thing which is > important (in context of vma-softdirty) is the vma's presence. Hugh, > mind to refresh my memory, how long ago the discussion took place? Sorry for making you think you were losing your mind, Cyrill. I myself have no recollection of any such conversation with you; but afraid that I might have lost _my_ memory of it - I didn't want to get too strident about how fragile (though probably not yet buggy) this down_read-for-updating-VM_SOFTDIRTY-onlyi is, if there had already been such a discussion, coming to the conclusion that it is okay for now. I am fairly sure that I have had some such discussion before; but probably with someone else, probably still about mmap_sem and vm_flags, but probably some other VM_flag: the surprising realization that it may be safe but fragile to use just down_read for updating one particular flag. Hugh -- 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>