Date: Sun, 22 Jun 2008 10:35:50 -0700 (PDT) From: Linus Torvalds Subject: Re: [patch] mm: fix race in COW logic In-Reply-To: Message-ID: References: <20080622153035.GA31114@wotan.suse.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Hugh Dickins Cc: Nick Piggin , Linux Memory Management List , Andrew Morton List-ID: On Sun, 22 Jun 2008, Hugh Dickins wrote: > > You have a wicked mind, and I think you're right, and the fix right. Agreed. I think the patch is fine, although I'd personally probably like it even more if the mm counter updates to follow the rmap updates. > One thing though, in moving the page_remove_rmap in that way, aren't > you assuming that there's an appropriate wmbarrier between the two > locations? If that is necessarily so (there's plenty happening in > between), it may deserve a comment to say just where that barrier is. In this case, I don't think memory ordering matters. What matters is that the map count never goes down to one - and by re-ordering the inc/dec accesses, that simply won't happen. IOW, memory ordering is immaterial, only the ordering of count updates (from the standpoint of the faulting CPU - so that's not even an SMP issue) matters. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org