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 AC7793AEF37 for ; Wed, 14 Jan 2026 22:12:06 +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=1768428726; cv=none; b=cI/Ps1OcWhuvt1kl/GF0k+yJw+I3mSx2B8wqnE3Q6TFjoRfswVof9wQlrITuTaJIyRM07EI7Mq8PY1UxQ8os+QGBsDYi8VBNNb7jhkBlmo8JI+7uBmLRVVtWpaAU8We+wCkd35lTbwDxYmmBy4OJ9oLlL41wu8HY7AMPFZ90eFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768428726; c=relaxed/simple; bh=t5WWRCehJoLylAD+uLC9ZU6ijAK40ffTm6B6Yhk+ORo=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=umEafkxblqT7gqlDXWifntVVM4+j/TXxnfg7uYjFtKMsMKEjyQIH8KJQASy9B0XiwbvkZyI6xaJ/njyxRea7khQZ1/GS5E1G7SvFLxjEXGMo96GSzbP7fQ2R9OjoT4VMGei3qxb8EHGra3RMecBOBAyk3FbkZKoTgVAyR6zFKk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=WSuNNom6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="WSuNNom6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01033C4CEF7; Wed, 14 Jan 2026 22:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1768428725; bh=t5WWRCehJoLylAD+uLC9ZU6ijAK40ffTm6B6Yhk+ORo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WSuNNom6LSt95XERmTGPYvgiAT7FgMuu/OJHMHhSrrMr/BB/rY8B/qYezagnd6lNS MfsU3Th1CVCTSqLcxSp8b+PlMfjGErMD31qESGOHa9+ejBISiYs3EPdvaEcB+Ud90z H2cAfHKkH69QDFOumPOeRmIL7M3w912eyX0VQ+hk= Date: Wed, 14 Jan 2026 14:12:04 -0800 From: Andrew Morton To: Lorenzo Stoakes Cc: Suren Baghdasaryan , "Liam R . Howlett" , Vlastimil Babka , Shakeel Butt , David Hildenbrand , Rik van Riel , Harry Yoo , Jann Horn , Mike Rapoport , Michal Hocko , Pedro Falcato , Chris Li , Barry Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/8] mm/rmap: remove unnecessary root lock dance in anon_vma clone, unmap Message-Id: <20260114141204.d13c3a00aec1333e8ad45a8c@linux-foundation.org> In-Reply-To: <2808d8d8-e772-4210-ada4-2b39d30c7029@lucifer.local> References: <9b5a438237e4ea3b19a986a4f8fddb8848cba54a.1767711638.git.lorenzo.stoakes@oracle.com> <2808d8d8-e772-4210-ada4-2b39d30c7029@lucifer.local> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 14 Jan 2026 17:54:07 +0000 Lorenzo Stoakes wrote: > > > { > > > @@ -310,26 +284,28 @@ static void cleanup_partial_anon_vmas(struct vm_area_struct *vma); > > > int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) > > > { > > > struct anon_vma_chain *avc, *pavc; > > > - struct anon_vma *root = NULL; > > > > > > check_anon_vma_clone(dst, src); > > > > > > if (!src->anon_vma) > > > return 0; > > > > > > + check_anon_vma_clone(dst, src); > > > > check_anon_vma_clone() was already called 4 lines above. I'm guessing > > this was accidentally carried over from the previous version? > > > > Yeah I don't know why this is here, in the tree it isn't, maybe Andrew noticed > and elided? :) Thanks, but I wouldn't have done that silently. The later "mm/rmap: separate out fork-only logic on anon_vma_clone()" removed it: : @@ -281,17 +317,17 @@ static void cleanup_partial_anon_vmas(st : * : * Returns: 0 on success, -ENOMEM on failure. : */ : -int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) : +int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src, : + enum vma_operation operation) : { : struct anon_vma_chain *avc, *pavc; : + struct anon_vma *active_anon_vma = src->anon_vma; : : - check_anon_vma_clone(dst, src); : + check_anon_vma_clone(dst, src, operation); : : - if (!src->anon_vma) : + if (!active_anon_vma) : return 0; : : - check_anon_vma_clone(dst, src); : - : /* : * Allocate AVCs. We don't need an anon_vma lock for this as we : * are not updating the anon_vma rbtree nor are we changing