From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 463C63DDDCD; Tue, 24 Mar 2026 16:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774370122; cv=none; b=qYci5dqyf7AmmAxg7/zogFolhE+E2jaGMZ0YAVBkfyoI6qLQI1AiqDh0hdLHfrKwSWKdem99eOW+ab8Qc+SAdoihz3/wVOLpYgHE0lWbFtaM/wHPiE40dxueg0cVA31tvkbOwTsqIWeeUyy8j9roIhJbzZ6eGgMkf7ge06oKA4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774370122; c=relaxed/simple; bh=uvgrzaHO3grkwKy9+089vaxpnmbs4+0xFVD7fE+BlCg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GfrUkX7GZjvmykWCP1v4WT3N9hTKVip2s8RQMu3ALVQBE49hXyTWs5rCZ5HrLSPsjK4Rxwlc+w9KK5pqtZYB3adM89PIooo69HfG3fiRYsdxN5lOjrPzp3FfofC5Hwa4E/N9y3Eiy9xqohW6PzaGl/gaIiQStUYRkR1HGtul6/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mCj3nnRZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mCj3nnRZ" 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: Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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; > >