From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFA00C352A4 for ; Mon, 10 Feb 2020 22:00:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6BD6D2082F for ; Mon, 10 Feb 2020 22:00:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="r7yxZENh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BD6D2082F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0999D6B0181; Mon, 10 Feb 2020 17:00:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 071F86B0183; Mon, 10 Feb 2020 17:00:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC8B86B0184; Mon, 10 Feb 2020 17:00:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id D2D3E6B0181 for ; Mon, 10 Feb 2020 17:00:52 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7BC888248076 for ; Mon, 10 Feb 2020 22:00:52 +0000 (UTC) X-FDA: 76475587944.22.rub01_78cd9616ed19 X-HE-Tag: rub01_78cd9616ed19 X-Filterd-Recvd-Size: 3224 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 22:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=OP2fL3Qx4WyjaGskShaeCNBmoSuChUmrsXOHm62ZZEU=; b=r7yxZENhPhlpKm3xhbcXAgQKGN ZDPyqVelZ5FqsRWTe2k7++tHQep0rqhx3hrSu5W4Nu/ugFPG5IHRFlkthggBFMKIMwF/meTP2wmP8 sLkDM1FF07VSy1ZUHMXhI2w0ZoEMiqMBrJDTCekxYB3CCGMmd2pC95hP+9uvnEcDCwJQzYEuHGXEn 2b6SOMGWVG556OVIrFAvG3D519PPMTaA4Gio0vwYu4PfH7C9EZGiXA5e7TW0xuV+ktN+QDtzOinri 1P4mSbrTdrhbY2rJ5sKBXpe84azPIoBOQAAA/XoqNZQA+BVDTYN9CUkDoFZcsRpGKlf+Ab/QbRwNx oe0RTpwg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1H6g-0005j7-Qc; Mon, 10 Feb 2020 22:00:42 +0000 Date: Mon, 10 Feb 2020 14:00:42 -0800 From: Matthew Wilcox To: Peter Zijlstra Cc: SeongJae Park , Michal Hocko , Vlastimil Babka , "Kirill A. Shutemov" , linux-mm@kvack.org Subject: Re: Re: Splitting the mmap_sem Message-ID: <20200210220042.GN8731@bombadil.infradead.org> References: <20200109170715.GV4951@dhcp22.suse.cz> <20200109173206.3731-1-sj38.park@gmail.com> <20200109201320.GO6788@bombadil.infradead.org> <20200206135920.GS14914@hirez.programming.kicks-ass.net> <20200206201536.GX8731@bombadil.infradead.org> <20200206205529.GZ14914@hirez.programming.kicks-ass.net> <20200206212024.GB8731@bombadil.infradead.org> <20200207085234.GB14914@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200207085234.GB14914@hirez.programming.kicks-ass.net> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Feb 07, 2020 at 09:52:34AM +0100, Peter Zijlstra wrote: > On Thu, Feb 06, 2020 at 01:20:24PM -0800, Matthew Wilcox wrote: > > If you use SRCU, why would you need a second page table walk? > > Because SRCU only ensures the VMA object remains extant, it does not > prevent modification of it, normally that guarantee is provided by > mmap_sem, but we're not going to use that. > > Instead, what we serialize on is the (split) ptlock. So we do the first > page-walk and ptlock to verify the vma-lookup, then we drop ptlock and > do the file-io, then we page-walk and take ptlock again, verify the vma > (again) and install the PTE. If anything goes wrong, we bail. > > See this patch: > > https://lkml.kernel.org/r/301fb863785f37c319b493bd0d43167353871804.1479465699.git.ldufour@linux.vnet.ibm.com OK, this gets to a difference in how we see modification to a VMA working. You take a seqcount in patch 5: https://lore.kernel.org/linux-mm/95790e53bfcfb536eb8f1dcdf4750e7e8050d8f4.1479465699.git.ldufour@linux.vnet.ibm.com/ I was intending to postpone the page table flushing parts of a VMA modification until a grace period had passed, but what you're doing is faster.