]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/rmap: not necessary to mask off FOLIO_PAGES_MAPPED
authorWei Yang <richard.weiyang@gmail.com>
Sun, 17 Aug 2025 03:26:46 +0000 (03:26 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:10 +0000 (17:25 -0700)
At this point, we are in an if branch conditional on (nr <
ENTIRELY_MAPPED), and FOLIO_PAGES_MAPPED is equal to (ENTIRELY_MAPPED -
1).  This means the upper bits are already cleared.

It is not necessary to mask it off.

Link: https://lkml.kernel.org/r/20250817032647.29147-2-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/rmap.c

index 1c5988dbd1e74d20b46d8c32c64f4b57af2b8850..a927437a56c2c00d951a58395e2701f5d49c46db 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1749,7 +1749,7 @@ static __always_inline void __folio_remove_rmap(struct folio *folio,
                                nr_pages = folio_large_nr_pages(folio);
                                if (level == PGTABLE_LEVEL_PMD)
                                        nr_pmdmapped = nr_pages;
-                               nr = nr_pages - (nr & FOLIO_PAGES_MAPPED);
+                               nr = nr_pages - nr;
                                /* Raced ahead of another remove and an add? */
                                if (unlikely(nr < 0))
                                        nr = 0;