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 4D43A23909F for ; Mon, 26 Jan 2026 18:02:14 +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=1769450534; cv=none; b=q6YF9KmWAv0zPx/ZWDoQcC9K+IYCR57bnVHa6+M3tvAyNqz+7UqIPnk472s/ENIqonTxnzm7aO5BQMu/tnB0BGfo124nCLZxiMStkEovYzAawC5iZPNa6j7bjJ91d2DgQGy0COZYpv7GxWL2yIopPRAGVo3QJRraGGyAX8d3/mk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769450534; c=relaxed/simple; bh=lCvaMyzjzrYuc4i1JdyK/tlHLhPQvVX9XB6IP4D5vuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sd6y4EaeYxh1o3S9jJ51SDEJATFXQljtSV4kUymwGZGhfNrWIyNuuYBR96C1RFuSDPpIU8iGr0emoz7mhih8eYw7U6B5JHmoY9vHGp+Sg14HPwI21nF7aaJhQdKDk7LXCBKEz5/1MZeBAPA4DgETJzDywTbURiXkpwpVnaCTlgY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VAZrgsGw; 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="VAZrgsGw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE597C116C6; Mon, 26 Jan 2026 18:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769450533; bh=lCvaMyzjzrYuc4i1JdyK/tlHLhPQvVX9XB6IP4D5vuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VAZrgsGw+6BDLtgFhwbRUVgRPydx/L2E+WzJ75ZB7xdrWP6nEGm7hy5zl3Z/Rrgcb o1sqKY17eX5LbUdNsRfh6FuvkUIm3txF5XIiAraRFc0BDnlVvsNu0dat01+DXWzBuw WMCEcFy1DjmVX25bpEY7A5D67lPqNczc4kzypoYtz3chaIlxyWtA6529d2a89Lj0Xg hN4Ghl0L4fUuCjVqPDPMLzZBkTQF07a1RiaFLA5ZWlkooRM5e83htHT6qsqhHcJgUJ NmIz3jN1IBIXwx9Ds5fqRO4KsGl/ujODaB0u+7A97FHVCFh6rqttJGeWtKsBPqD9dh thbpEe9rUbCGA== From: Sasha Levin To: stable@vger.kernel.org Cc: "David Hildenbrand (Red Hat)" , Rik van Riel , Laurence Oberman , Lorenzo Stoakes , Oscar Salvador , Liu Shixin , Harry Yoo , Lance Yang , "Uschakow, Stanislav" , Andrew Morton , Sasha Levin Subject: [PATCH 6.1.y] mm/rmap: fix two comments related to huge_pmd_unshare() Date: Mon, 26 Jan 2026 13:02:11 -0500 Message-ID: <20260126180211.3511367-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026012637-grope-geologic-e069@gregkh> References: <2026012637-grope-geologic-e069@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "David Hildenbrand (Red Hat)" [ Upstream commit a8682d500f691b6dfaa16ae1502d990aeb86e8be ] 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. Link: https://lkml.kernel.org/r/20251223214037.580860-4-david@kernel.org Fixes: 59d9094df3d7 ("mm: hugetlb: independent PMD page table shared count") Signed-off-by: David Hildenbrand (Red Hat) Reviewed-by: Rik van Riel Tested-by: Laurence Oberman Reviewed-by: Lorenzo Stoakes Acked-by: Oscar Salvador Cc: Liu Shixin Cc: Harry Yoo Cc: Lance Yang Cc: "Uschakow, Stanislav" Cc: Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- mm/rmap.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 7d7bacd37ff4d..49d48a427f084 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1574,14 +1574,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, mmu_notifier_invalidate_range(mm, 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. */ page_vma_mapped_walk_done(&pvmw); break; @@ -1965,14 +1959,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *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. */ page_vma_mapped_walk_done(&pvmw); break; -- 2.51.0