From nobody Tue Dec 16 14:34:25 2025 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 B803B23D7E3; Fri, 5 Dec 2025 21:36:24 +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=1764970584; cv=none; b=tFi4WnHn2WdJbkD4eezOPtHbF3w5tU7IHg+1OnB26sdf07CzsZ1qrTGiRldA/vhyjevWZwVyqpx/KIxHuiNnRUztwbtzLpaim5NmVZOT9jdqn+P1hM883f/hgjFv0f4cN1fPhQ0gJUzlIJ1DaQiovOmhoP21FTjL7c/U6WbCQfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764970584; c=relaxed/simple; bh=o38uGAMpi9BdWN5xQqMRFNTmj6rucJFF3oUHW7Ho378=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iupfbrg+HGHqoo6H7SOTmNd46HxUD0wJw2FviqggNab02GBxZ9OobogTk7mzU41bIzSWxnKiT4kg152pJavdUsiVR+yqpRAtFs8vKNmbmPjpnLRVJar2BrwH5hyhx/4NRbkaFbhVDW08ryMoz5WzL4BfOfpqjSed051TzXjzUpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S1GwPY7f; 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="S1GwPY7f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0112C4CEF1; Fri, 5 Dec 2025 21:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764970584; bh=o38uGAMpi9BdWN5xQqMRFNTmj6rucJFF3oUHW7Ho378=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S1GwPY7f7m7pYaS3MVCNK7lzPbKUsHhv56xvJR387DiEcS3s+1L9IoIEdiQjKnPJF syWDzZO95NkH0eeBJih2q7r/rKlfAnR4OM1GX0IdU/1RGPWDi+z15xlnuHTZxwiRsM QXp2v+PFeEYzsxJDj+DOgl8D5s8QF7MJgTDQXndp+pEgFiNeVwSG520KB6QuDytMGd 87faJ8Hv31qdU86J7RatR2JmGzqLfyu1qpWjM1hCx/4adbMzFyFlnqGHPIZoPIf1GG Cpa8yKbeULm/1EO2jpSCdRhuVdL1+R6TUzR5/hWySi0TIoBxplT5BVRK5S1+1gVEGJ F1GV04axuZtZQ== From: "David Hildenbrand (Red Hat)" To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, "David Hildenbrand (Red Hat)" , Will Deacon , "Aneesh Kumar K.V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Arnd Bergmann , Muchun Song , Oscar Salvador , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Pedro Falcato , Rik van Riel , Harry Yoo , Laurence Oberman , Prakash Sangappa , Nadav Amit , Liu Shixin Subject: [PATCH v1 3/4] mm/rmap: fix two comments related to huge_pmd_unshare() Date: Fri, 5 Dec 2025 22:35:57 +0100 Message-ID: <20251205213558.2980480-4-david@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251205213558.2980480-1-david@kernel.org> References: <20251205213558.2980480-1-david@kernel.org> 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" PMD page table unsharing no longer touches the refcount of a PMD page table. Also, it is not about dropping the refcount of a "PMD page" but the "PMD page table". Let's just simplify by saying that the PMD page table was unmapped, consequently also unmapping the folio that was mapped into this page. This code should be deduplicated in the future. Fixes: 59d9094df3d7 ("mm: hugetlb: independent PMD page table shared count") Cc: Liu Shixin Signed-off-by: David Hildenbrand (Red Hat) Acked-by: Oscar Salvador Reviewed-by: Lorenzo Stoakes Reviewed-by: Rik van Riel --- mm/rmap.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index f955f02d570ed..748f48727a162 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2016,14 +2016,8 @@ static bool try_to_unmap_one(struct folio *folio, st= ruct vm_area_struct *vma, flush_tlb_range(vma, range.start, range.end); /* - * The ref count of the PMD page was - * dropped which is part of the way map - * counting is done for shared PMDs. - * Return 'true' here. When there is - * no other sharing, huge_pmd_unshare - * returns false and we will unmap the - * actual page and drop map count - * to zero. + * The PMD table was unmapped, + * consequently unmapping the folio. */ goto walk_done; } @@ -2416,14 +2410,8 @@ static bool try_to_migrate_one(struct folio *folio, = struct vm_area_struct *vma, range.start, range.end); =20 /* - * The ref count of the PMD page was - * dropped which is part of the way map - * counting is done for shared PMDs. - * Return 'true' here. When there is - * no other sharing, huge_pmd_unshare - * returns false and we will unmap the - * actual page and drop map count - * to zero. + * The PMD table was unmapped, + * consequently unmapping the folio. */ page_vma_mapped_walk_done(&pvmw); break; --=20 2.52.0