From: Wei Yang Date: Sun, 17 Aug 2025 03:26:46 +0000 (+0000) Subject: mm/rmap: not necessary to mask off FOLIO_PAGES_MAPPED X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3da928fc5b88168634bcbdeba2db4bdf6961080e;p=users%2Fjedix%2Flinux-maple.git mm/rmap: not necessary to mask off FOLIO_PAGES_MAPPED 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 Reviewed-by: Lorenzo Stoakes Acked-by: David Hildenbrand Cc: Rik van Riel Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Harry Yoo Signed-off-by: Andrew Morton --- diff --git a/mm/rmap.c b/mm/rmap.c index 1c5988dbd1e7..a927437a56c2 100644 --- 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;