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 49C0F3FE34B; Tue, 24 Mar 2026 14:26:38 +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=1774362398; cv=none; b=Uc3mdKLN4zCahXUVz7QBNxcvYVgup2clcAOyc/A8LMHE4KpZEzxNElwlLC6TesN6AkHpLtUulkSbAuQh6jBJ9KdlRy6U5kHcD9LNtf+h7TOTJ06nKDUreoZLXIf9qNX9xhSY7KGijJ9wdKg+gwvxGL9mKJt//N5Uf25kVDN+R7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774362398; c=relaxed/simple; bh=jbmeTUiHgD1/BUVa6y6/L4uBWdzAaIyEnuCWg6Aqqwk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FuWFEN7dJWXxy9cMoQNY3TpB9ZzxbguBat3WlCvj80xu4F2ksESfe5mRSnQbqTmACC40r/6+iM2tsLLLURY+OtrD/k+VUq9UTtTM1z5bJfv3xcsxFP1jn74iKCFnmHWUEwwJCyYWf6TMkjwWaqW/UVnSsK9q5BxJJOFRvhJ/gnU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jHLE0f+j; 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="jHLE0f+j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF10FC19424; Tue, 24 Mar 2026 14:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774362397; bh=jbmeTUiHgD1/BUVa6y6/L4uBWdzAaIyEnuCWg6Aqqwk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jHLE0f+jKQrZNp687YBoBRWvKqV1yWHDJoeSVdPwmNvSWECrmPXDTbAi2oKjk+1NJ qnx4cHZLM+LIL/EoJtJgr2egOHXEYl3PmIEgTgWfctCXapgNTUzCU72gmELiYyBz2u Bmagz4Dqlv/xXZnYGIqOcn/VE+9HcIDQca+kSTZwU2EdFdYDcSCQi3OsySsDqMWMEj xJBl1+rl8ONOJYI/rFp2Q6/AgAT6Ooo3EbuSldP/+bCHPCgnXfLdZYk7zRnOoBztke 5D4hhUKhkSo5DjVR7YkZzeoY/AhHGi4yeVpH65JJi5N0Pl6nFAlDHXYhnAvm2OMXP/ QLKTQd8HLcvhQ== Message-ID: Date: Tue, 24 Mar 2026 15:26:28 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 05/21] mm: switch the rmap lock held option off in compat layer Content-Language: en-US To: "Lorenzo Stoakes (Oracle)" , Andrew Morton Cc: 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 References: From: "Vlastimil Babka (SUSE)" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > + 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; >