Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753941AbdH2Nq3 (ORCPT ); Tue, 29 Aug 2017 09:46:29 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40212 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbdH2Nq2 (ORCPT ); Tue, 29 Aug 2017 09:46:28 -0400 Date: Tue, 29 Aug 2017 15:45:50 +0200 From: Peter Zijlstra To: Laurent Dufour Cc: "Kirill A. Shutemov" , paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v2 14/20] mm: Provide speculative fault infrastructure Message-ID: <20170829134550.t7du5zdssvlzemtk@hirez.programming.kicks-ass.net> References: <1503007519-26777-1-git-send-email-ldufour@linux.vnet.ibm.com> <1503007519-26777-15-git-send-email-ldufour@linux.vnet.ibm.com> <20170827001823.n5wgkfq36z6snvf2@node.shutemov.name> <507e79d5-59df-c5b5-106d-970c9353d9bc@linux.vnet.ibm.com> <20170829120426.4ar56rbmiupbqmio@hirez.programming.kicks-ass.net> <848fa2c6-dbda-9a1e-2efd-3ce9b083365e@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <848fa2c6-dbda-9a1e-2efd-3ce9b083365e@linux.vnet.ibm.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1363 Lines: 35 On Tue, Aug 29, 2017 at 03:18:25PM +0200, Laurent Dufour wrote: > On 29/08/2017 14:04, Peter Zijlstra wrote: > > On Tue, Aug 29, 2017 at 09:59:30AM +0200, Laurent Dufour wrote: > >> On 27/08/2017 02:18, Kirill A. Shutemov wrote: > >>>> + > >>>> + if (unlikely(!vma->anon_vma)) > >>>> + goto unlock; > >>> > >>> It deserves a comment. > >> > >> You're right I'll add it in the next version. > >> For the record, the root cause is that __anon_vma_prepare() requires the > >> mmap_sem to be held because vm_next and vm_prev must be safe. > > > > But should that test not be: > > > > if (unlikely(vma_is_anonymous(vma) && !vma->anon_vma)) > > goto unlock; > > > > Because !anon vmas will never have ->anon_vma set and you don't want to > > exclude those. > > Yes in the case we later allow non anonymous vmas to be handled. > Currently only anonymous vmas are supported so the check is good enough, > isn't it ? That wasn't at all clear from reading the code. This makes it clear ->anon_vma is only ever looked at for anonymous. And like Kirill says, we _really_ should start allowing some (if not all) vm_ops. Large file based mappings aren't particularly rare. I'm not sure we want to introduce a white-list or just bite the bullet and audit all ->fault() implementations. But either works and isn't terribly difficult, auditing all is more work though.