Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1448796yba; Fri, 26 Apr 2019 23:02:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqweFUPzg+oxt70c02h4Eob8e31k47TcKr9IgeuUlJTIR9EbvLHoTwberV9I79GDVccaVkay X-Received: by 2002:a63:d816:: with SMTP id b22mr46939920pgh.349.1556344963119; Fri, 26 Apr 2019 23:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556344963; cv=none; d=google.com; s=arc-20160816; b=nXDGSIu7Sj0GR+phrvGVxUHv6q9sMsKT8Yv0Vkq+iOc+Q6GFWW18GCYgOyNAPU3YZ8 VR9km4BbX/8FpE+qY6hZlhu301E0A7yUnguQRKljSo68JXhQ5mcf0rsa6gAzRTZsJTAM Gy9iYwiJFa3IMrVmEM8eL/uZeSgQN6uM5XbFu84aJNug3zgPPU6KsIAw6LjmoLHOzihV J2nPJgqC16Cd4QPMWOLSb35DzIph8q64oMPX+Zo6QjRV9cWCRn81WSEP7RNNxsB+zzoF n3XKnZVfxztN5Tf+sGWxKEYBUXFunXFq2vy+6HN4LMJsRBaW8jPnL6Wn66/5RauT3oLm 5M1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9mSKg2SIvsOs/xLgAIl2pXj2eMJ9JaMiTd4MI5nAg04=; b=gc+BfKj6R0E+qEXgPKQX3TmDgzlzQomuGKTlsdfM3eEzar+rRM0x0xRhxrP9x9uMXv NFITTEAcA5lcrJIRPMzF52T6tIFwAGb2xtFU2YtB+XI/cSMjdW3X0DSWRIwpszvd8jWN FT1QLO02Em/3SMLapVsDEDoeriPQrekDt9+a84QSCT9hhvNquO5ywMxXo0NKq9mGySrj LOBiFf8/C95IVV1trx8yMKc2NYzGQnLcxSaO2q/p8wk+7LTX/X3H3nlhkdJUXagwoQEy fJf8Sig+kky9sdGVKyNlGoEhAFfTStRJGe3o+aKSFOJEKgWI/HGOZy/SDhbyQFfMsngI H4jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sQgZM+n9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si28298706pfh.257.2019.04.26.23.02.28; Fri, 26 Apr 2019 23:02:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sQgZM+n9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726247AbfD0GAQ (ORCPT + 99 others); Sat, 27 Apr 2019 02:00:16 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33277 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbfD0GAQ (ORCPT ); Sat, 27 Apr 2019 02:00:16 -0400 Received: by mail-pf1-f195.google.com with SMTP id h5so2735314pfo.0 for ; Fri, 26 Apr 2019 23:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=9mSKg2SIvsOs/xLgAIl2pXj2eMJ9JaMiTd4MI5nAg04=; b=sQgZM+n9Be/cWtzN8fNus9HazrNXXo2P9TnRXJ3OGXR/7LV1xuaW4rJA/roFhqf0TY mQCS64dg1TtuGiotH0xCet3pe1hS8IOvRcqAhBIgfyzwhLE/9ZwL2Gwe40/zd/NnkU+7 VrpMs8JFZ+ZUVmL6NL9u579BqupyJRMM5thKTY4byen+ygGpp6uuta11/qVxM0mde7gT NUJBfmXhweZUqn604h85jwvMEvFMmU1yG1Zy3ng8ZZlB4JTgg7O9/oy6VPt9CsqUZm4n K+HJubSlTziMfSj9ObPIOHOr59uF1HZw9VN8rdH7MqooI+xJn3y98FDtNsW803OpqSrv MhuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=9mSKg2SIvsOs/xLgAIl2pXj2eMJ9JaMiTd4MI5nAg04=; b=ZOD8PS7TckjBnnfGqCMmj9g5YnRPurGEPkqWSH673DNE0x7onap1LGL3gnCy8OvDDu fbTptW0LBaGwV6eqKBnVQhjIkzi8pzvOVI4gaHAXyb1ohg9r4YkOQUoCC7ipNUjz4BE+ 5JnpvmKixKvBlyN7dALKHjCxRvVkPyDTCobXGPcM13DHjFduYFI8JYvOmIQXNuV//Q+a DCxM0a3BrP4wZXd0i8O9SyMhERtgjT4cXs+VBlKhJwO25IOavsXJz84qUfRZ4Syf2pd+ tjKes+GRb79fYGFKD/xoC60yiSFjSbp65WBfeti99oS6MwF44MJT6YdC9wtd28n91orh tb8A== X-Gm-Message-State: APjAAAW3Kx4ujJp0R3WE5WVQB6sRBZO9l2pooy+kyRIOAy4Y+dEJR/aH AfZRM7yxP8TAqyRby7k59lCBYQ== X-Received: by 2002:a65:408b:: with SMTP id t11mr8911128pgp.372.1556344814717; Fri, 26 Apr 2019 23:00:14 -0700 (PDT) Received: from google.com ([2620:15c:2cd:202:668d:6035:b425:3a3a]) by smtp.gmail.com with ESMTPSA id u62sm44711410pfa.124.2019.04.26.23.00.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Apr 2019 23:00:13 -0700 (PDT) Date: Fri, 26 Apr 2019 23:00:10 -0700 From: Michel Lespinasse To: Laurent Dufour Cc: Andrew Morton , Michal Hocko , Peter Zijlstra , "Kirill A. Shutemov" , Andi Kleen , dave@stgolabs.net, Jan Kara , Matthew Wilcox , aneesh.kumar@linux.ibm.com, Benjamin Herrenschmidt , mpe@ellerman.id.au, Paul Mackerras , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Will Deacon , Sergey Senozhatsky , sergey.senozhatsky.work@gmail.com, Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, Daniel Jordan , David Rientjes , Jerome Glisse , Ganesh Mahendran , Minchan Kim , Punit Agrawal , vinayak menon , Yang Shi , zhong jiang , Haiyan Song , Balbir Singh , sj38.park@gmail.com, Mike Rapoport , LKML , linux-mm , haren@linux.vnet.ibm.com, Nick Piggin , "Paul E. McKenney" , Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v12 00/31] Speculative page faults Message-ID: <20190427060010.GB174296@google.com> References: <20190416134522.17540-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2019 at 08:01:20PM +0200, Laurent Dufour wrote: > Le 22/04/2019 ? 23:29, Michel Lespinasse a ?crit?: > > Hi Laurent, > > > > Thanks a lot for copying me on this patchset. It took me a few days to > > go through it - I had not been following the previous iterations of > > this series so I had to catch up. I will be sending comments for > > individual commits, but before tat I would like to discuss the series > > as a whole. > > Hi Michel, > > Thanks for reviewing this series. > > > I think these changes are a big step in the right direction. My main > > reservation about them is that they are additive - adding some complexity > > for speculative page faults - and I wonder if it'd be possible, over the > > long term, to replace the existing complexity we have in mmap_sem retry > > mechanisms instead of adding to it. This is not something that should > > block your progress, but I think it would be good, as we introduce spf, > > to evaluate whether we could eventually get all the way to removing the > > mmap_sem retry mechanism, or if we will actually have to keep both. > > Until we get rid of the mmap_sem which seems to be a very long story, I > can't see how we could get rid of the retry mechanism. Short answer: I'd like spf to be extended to handle file vmas, populating page tables, and the vm_normal_page thing, so that we wouldn't have to fall back to the path that grabs (and possibly has to drop) the read side mmap_sem. Even doing the above, there are still cases spf can't solve - for example, gup, or the occasional spf abort, or even the case of a large mmap/munmap delaying a smaller one. I think replacing mmap_sem with a reader/writer interval lock would be a very nice generic solution to this problem, allowing false conflicts to proceed in parallel, while synchronizing true conflicts which is exactly what we want. But I don't think such a lock can be implemented efficiently enough to be put on the page fault fast-path, so I think spf could be the solution there - it would allow us to skip taking that interval lock on most page faults. The other places where we use mmap_sem are not as critical for performance (they normally operate on a larger region at a time) so I think we could afford the interval lock in those places. -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies.