From nobody Sat Apr 4 04:41:39 2026 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 9FEAD3E122C for ; Fri, 20 Mar 2026 18:07:55 +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=1774030075; cv=none; b=p1L7UPbThOmk7Wf0hopvpda4ce7Palf3Vs/+/ql9Or6hXWYXzBxK35MwvWe0eVWopVyX/4HXSRyXMyeT9hS6xfJhihgMciNhd05kazsz5Gx86D7PnOggqKHKASATfBAM1Ijp/41mMIHbYnaQlUwBSXRZngWiDYqI7ruYIElcMcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774030075; c=relaxed/simple; bh=IQWNPr/YjOK/b68R1uDz3iksCldtt6DiEoWwwpqjSw4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mf8x7+6pQ7neArMXpUHTQkI/Kej8SBiabBz5mWefxLRUoTpmbW03XBHzTZzOTlE+URVSc8ub2qdCQVYe3MWZNCIihYst8Eyk+v3S26HPCwhqXcn393qAFfG/VHoqUkirJaDtcwoTDlTARvuwpJd3SLHR4s+6ndUfxpRVkVW0lvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PeHIahap; 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="PeHIahap" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D56DDC4CEF7; Fri, 20 Mar 2026 18:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774030075; bh=IQWNPr/YjOK/b68R1uDz3iksCldtt6DiEoWwwpqjSw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PeHIahapRFUfhv4MxV6dbM4uIo9f4A5EP85/jRgebgxMlSUZQ230V1BAGYtAX5wnY AtdaU9tRmjnjK+jB9d55FnBSJneIlvqSPcF9BMVnkMnrPRlzll4EQ0K5DDUfP9DEJ3 6xsQR9x7wVQ7DcqTqfPL7EjosB+qHAGqRwHp8apEHDj/rD/dEIhz9aazLEDa39v33j liF/cM2B18Xq7tRiLV/aM1q/RjtYTVkvD33HlnveheU9GMaCWVN5W8e7PEOO0SenDT 4HxMxPQGmvLp6zHnELygPPko/YMQWCx9VbEyQd6Qwu7aUzRgpqFV82XU/df4uNkuGc 4L1tYelROcJXA== From: "Lorenzo Stoakes (Oracle)" To: Andrew Morton Cc: David Hildenbrand , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Kiryl Shutsemau , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 08/13] mm/huge_memory: remove unnecessary sanity checks Date: Fri, 20 Mar 2026 18:07:25 +0000 Message-ID: <0c4c5ab247c90f80cf44718e8124b217d6a22544.1774029655.git.ljs@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" These checks have been in place since 2014, I think we can safely assume that we are in a place where we don't need these as runtime checks. In addition there are 4 other invocations of folio_remove_rmap_pmd(), none of which make this assertion. If we need to add this assertion, it should be in folio_remove_rmap_pmd(), and as a VM_WARN_ON_ONCE(), however these seem superfluous so just remove them. Signed-off-by: Lorenzo Stoakes (Oracle) Reviewed-by: Suren Baghdasaryan --- mm/huge_memory.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index fca44aec6022..c5b16c218900 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2371,7 +2371,6 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_a= rea_struct *vma, =20 flush_needed =3D true; folio_remove_rmap_pmd(folio, &folio->page, vma); - WARN_ON_ONCE(folio_mapcount(folio) < 0); } else if (pmd_is_valid_softleaf(orig_pmd)) { const softleaf_t entry =3D softleaf_from_pmd(orig_pmd); =20 @@ -2402,7 +2401,6 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_a= rea_struct *vma, =20 if (folio_is_device_private(folio)) { folio_remove_rmap_pmd(folio, &folio->page, vma); - WARN_ON_ONCE(folio_mapcount(folio) < 0); folio_put(folio); } =20 --=20 2.53.0