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 5DEB6233149 for ; Mon, 26 Jan 2026 17:55: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=1769450155; cv=none; b=Q2qsH06yXWWuZdPfw1axGT/CGXkjps85O7mbExwHIkivCC6g6adXgr5BWu2/2OfVaVnrHlRaNAGx9bPR3/IzTNt4w5IVjAp4XuUFpgfrLoyaneX9u+q9mMOPRFHPpY4Avx1kpxfzQE/F2lEws5rFLsiLzJdsydDXmLtY2G+p+HQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769450155; c=relaxed/simple; bh=NNK6LcNOKWJNboay3ctTHuitTF3qpeUJ3zeE5ODtjkA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M+O0Xy3dbTIRI20eUo9w+ga/XvaEHKYg7aWm9OutjNE//47WAMnz0z6Jak/6uZMz8Raa8iu1Qr3fNUB3n3S1sO2nIKZjNftpfQpywzWQX2FKXpazcN7rCkzv00QB4pIY5xLQq5JF81y27xXquA6g1oS9jMIchIHymPtg9JoRp8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q2nC4n7U; 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="Q2nC4n7U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6D1AC116C6; Mon, 26 Jan 2026 17:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769450154; bh=NNK6LcNOKWJNboay3ctTHuitTF3qpeUJ3zeE5ODtjkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q2nC4n7UAfI/cbiQn+k6Scx2geyUFYSHbaau8wzgAE6mN7zsf7KaPxEF0lqr3NWyv JEgaBr4lZNJwc+IcpxNONGjHhaKx6hzRvhc4v72fGu7hYVm/E9etz3m0cRCQcvzmX8 dB2oB7EZRxn4OcXiSSx3g7/FPOFoCey3+yjinOupEsgExahNHTGqs01BxP9HOqvZGV d66db/eR/gAA5qH10A7pF8/kCphrmoQzovuyaWVfVJrSfwZDfWxWq0pFNAWfvczYHG +XrkP8dEYMtUo70g5IkGLlb8wVOgAFbbh8UCF3LFhNGRUxqJ8HLCxNxT4ydkFsv4Pl dEmSDav7RLCPw== 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.6.y] mm/rmap: fix two comments related to huge_pmd_unshare() Date: Mon, 26 Jan 2026 12:55:51 -0500 Message-ID: <20260126175552.3481327-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026012636-hankie-scribing-0c00@gregkh> References: <2026012636-hankie-scribing-0c00@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 968b85a67b1a1..b511dd811c30c 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1579,14 +1579,8 @@ static bool try_to_unmap_one(struct folio *folio, struct 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. */ page_vma_mapped_walk_done(&pvmw); break; @@ -1945,14 +1939,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