]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mm/rmap: fix two comments related to huge_pmd_unshare()
authorDavid Hildenbrand (Red Hat) <david@kernel.org>
Mon, 26 Jan 2026 18:02:11 +0000 (13:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:44:18 +0000 (16:44 +0100)
[ 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) <david@kernel.org>
Reviewed-by: Rik van Riel <riel@surriel.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: Oscar Salvador <osalvador@suse.de>
Cc: Liu Shixin <liushixin2@huawei.com>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: "Uschakow, Stanislav" <suschako@amazon.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/rmap.c

index 7d7bacd37ff4dcc38bc96b0b35eef436d26d99c2..49d48a427f0841752f2d9e59696154113f7f3e5b 100644 (file)
--- 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;