From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by kanga.kvack.org (Postfix) with ESMTP id 0CFB782F8A for ; Mon, 19 Oct 2015 17:53:46 -0400 (EDT) Received: by wicfx6 with SMTP id fx6so19011495wic.1 for ; Mon, 19 Oct 2015 14:53:45 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com. [209.85.212.171]) by mx.google.com with ESMTPS id hf9si43829540wjc.36.2015.10.19.14.53.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 14:53:45 -0700 (PDT) Received: by wikq8 with SMTP id q8so19004930wik.1 for ; Mon, 19 Oct 2015 14:53:44 -0700 (PDT) Date: Tue, 20 Oct 2015 00:53:42 +0300 From: "Kirill A. Shutemov" Subject: Re: [PATCH 2/12] mm: rmap use pte lock not mmap_sem to set PageMlocked Message-ID: <20151019215342.GA18625@node.shutemov.name> References: <56248C5B.3040505@suse.cz> <20151019131308.GB15819@node.shutemov.name> <20151019201003.GA18106@node.shutemov.name> <56255FE4.5070609@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56255FE4.5070609@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Vlastimil Babka Cc: Hugh Dickins , Andrew Morton , Christoph Lameter , "Kirill A. Shutemov" , Rik van Riel , Davidlohr Bueso , Oleg Nesterov , Sasha Levin , Andrey Konovalov , Dmitry Vyukov , KOSAKI Motohiro , linux-mm@kvack.org, "Paul E. McKenney" 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@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org