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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AED5F54AD9 for ; Tue, 24 Mar 2026 16:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W/aJXaKiUSMSw1tUBsHjBJ8n/KyhSShc5r5U9xDSJag=; b=fIRZss7E3Bq1Nv+oXJy0616O5j UlewW37luz2A9EsHXh5tfkJS8CqiE/LAfo343ZBR4MNo7hdVXEMtJtktig21uw0dyV9ea8tsIctrF yWQ1/+jCuZnnqbpBk8TUyRfzVqcCuNAJjfBCOoNFxJ6tXnsOhkRKyrHIQUk76X+jI6rsg6m9pOSfc 6S8MtSlEq0S3MONu25Rhukyprl4gokA5pN7swAikWDKzGEdkBpTnVObgheeZsqC0mGT/VErMJLqYI zIqyv9s9vJcHfTo9tq5KzUNFsDYZn/JIGGCEGLvTdAqPg8hLBbTr9HvJcHqDMyLOv56QPcShVOAXL SSgO3t6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1w54iz-00000001tZv-3IVR; Tue, 24 Mar 2026 16:35:25 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1w54ix-00000001tZT-0JAW; Tue, 24 Mar 2026 16:35:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id E6FAE43878; Tue, 24 Mar 2026 16:35:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A27FCC19424; Tue, 24 Mar 2026 16:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774370121; bh=uvgrzaHO3grkwKy9+089vaxpnmbs4+0xFVD7fE+BlCg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mCj3nnRZEPIdtmViKw3PDpai7OwDquEgzLJEZ26oE90AfteaXy0i9TaB/c7BaxFvb TbEiCuWEA6Wv27Asd6DPIJsTH4Mx9POnWfqMFokRI+bLy/W2CLoSfDEWfM24Us13Cs QXtvIAoK0qd8ujZUWv2rJrVyiBeVoH8QP/Ob/fjUArQV4sgDIv/QN7M4pvzKbUoZdK +j93tcLxP+JAgxjn7Uj5hDnfPw51TI0eFm6GJldqWDg6h4T1BtYK6geAEWodxE/Zw7 nSMQAMGNOD6Cc/Ya9icBBPVn1CDFRReP2qnF9OeRpbQUvvkbOLXBBmRg8bD9QubspZ mndsFT1HJo3ng== Date: Tue, 24 Mar 2026 16:35:10 +0000 From: "Lorenzo Stoakes (Oracle)" To: "Vlastimil Babka (SUSE)" Cc: Andrew Morton , Jonathan Corbet , Clemens Ladisch , Arnd Bergmann , Greg Kroah-Hartman , "K . Y . Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Bodo Stroesser , "Martin K . Petersen" , David Howells , Marc Dionne , Alexander Viro , Christian Brauner , Jan Kara , David Hildenbrand , "Liam R . Howlett" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-staging@lists.linux.dev, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Ryan Roberts Subject: Re: [PATCH v4 05/21] mm: switch the rmap lock held option off in compat layer Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260324_093523_154122_9932AB2E X-CRM114-Status: GOOD ( 22.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 24, 2026 at 03:26:28PM +0100, Vlastimil Babka (SUSE) wrote: > On 3/20/26 23:39, Lorenzo Stoakes (Oracle) wrote: > > In the mmap_prepare compatibility layer, we don't need to hold the rmap > > lock, as we are being called from an .mmap handler. > > > > The .mmap_prepare hook, when invoked in the VMA logic, is called prior to > > the VMA being instantiated, but the completion hook is called after the VMA > > is linked into the maple tree, meaning rmap walkers can reach it. > > > > The mmap hook does not link the VMA into the tree, so this cannot happen. > > > > Therefore it's safe to simply disable this in the mmap_prepare > > compatibility layer. > > > > Also update VMA tests code to reflect current compatibility layer state. > > > > Signed-off-by: Lorenzo Stoakes (Oracle) > > Acked-by: Vlastimil Babka (SUSE) > > a typo fix below, Andrew can fix locally? > > > --- > > mm/util.c | 6 ++++- > > tools/testing/vma/include/dup.h | 42 +++++++++++++++++---------------- > > 2 files changed, 27 insertions(+), 21 deletions(-) > > > > diff --git a/mm/util.c b/mm/util.c > > index a2cfa0d77c35..182f0f5cc400 100644 > > --- a/mm/util.c > > +++ b/mm/util.c > > @@ -1204,6 +1204,7 @@ int compat_vma_mmap(struct file *file, struct vm_area_struct *vma) > > > > .action.type = MMAP_NOTHING, /* Default */ > > }; > > + struct mmap_action *action = &desc.action; > > int err; > > > > err = vfs_mmap_prepare(file, &desc); > > @@ -1214,8 +1215,11 @@ int compat_vma_mmap(struct file *file, struct vm_area_struct *vma) > > if (err) > > return err; > > > > + /* being invoked from .mmmap means we don't have to enforce this. */ > > .mmap mmmmm map! ;) Andrew - could you fixup in place? Thanks. > > > + action->hide_from_rmap_until_complete = false; > > + > > set_vma_from_desc(vma, &desc); > > - err = mmap_action_complete(vma, &desc.action); > > + err = mmap_action_complete(vma, action); > > if (err) { > > const size_t len = vma_pages(vma) << PAGE_SHIFT; > >