Skip to content

Commit 55c62fa

Browse files
davidhildenbrandtorvalds
authored andcommitted
mm/huge_memory: remove stale page_trans_huge_mapcount()
All users are gone, let's remove it. Link: https://lkml.kernel.org/r/20220131162940.210846-9-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: David Rientjes <rientjes@google.com> Cc: Don Dutile <ddutile@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jan Kara <jack@suse.cz> Cc: Jann Horn <jannh@google.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Liang Zhang <zhangliang5@huawei.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Nadav Amit <nadav.amit@gmail.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Xu <peterx@redhat.com> Cc: Rik van Riel <riel@surriel.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Shakeel Butt <shakeelb@google.com> Cc: Yang Shi <shy828301@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 03104c2 commit 55c62fa

2 files changed

Lines changed: 0 additions & 53 deletions

File tree

include/linux/mm.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -834,16 +834,11 @@ static inline int total_mapcount(struct page *page)
834834
return folio_mapcount(page_folio(page));
835835
}
836836

837-
int page_trans_huge_mapcount(struct page *page);
838837
#else
839838
static inline int total_mapcount(struct page *page)
840839
{
841840
return page_mapcount(page);
842841
}
843-
static inline int page_trans_huge_mapcount(struct page *page)
844-
{
845-
return page_mapcount(page);
846-
}
847842
#endif
848843

849844
static inline struct page *virt_to_head_page(const void *x)

mm/huge_memory.c

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,54 +2483,6 @@ static void __split_huge_page(struct page *page, struct list_head *list,
24832483
}
24842484
}
24852485

2486-
/*
2487-
* This calculates accurately how many mappings a transparent hugepage
2488-
* has (unlike page_mapcount() which isn't fully accurate). This full
2489-
* accuracy is primarily needed to know if copy-on-write faults can
2490-
* reuse the page and change the mapping to read-write instead of
2491-
* copying them. At the same time this returns the total_mapcount too.
2492-
*
2493-
* The function returns the highest mapcount any one of the subpages
2494-
* has. If the return value is one, even if different processes are
2495-
* mapping different subpages of the transparent hugepage, they can
2496-
* all reuse it, because each process is reusing a different subpage.
2497-
*
2498-
* The total_mapcount is instead counting all virtual mappings of the
2499-
* subpages. If the total_mapcount is equal to "one", it tells the
2500-
* caller all mappings belong to the same "mm" and in turn the
2501-
* anon_vma of the transparent hugepage can become the vma->anon_vma
2502-
* local one as no other process may be mapping any of the subpages.
2503-
*
2504-
* It would be more accurate to replace page_mapcount() with
2505-
* page_trans_huge_mapcount(), however we only use
2506-
* page_trans_huge_mapcount() in the copy-on-write faults where we
2507-
* need full accuracy to avoid breaking page pinning, because
2508-
* page_trans_huge_mapcount() is slower than page_mapcount().
2509-
*/
2510-
int page_trans_huge_mapcount(struct page *page)
2511-
{
2512-
int i, ret;
2513-
2514-
/* hugetlbfs shouldn't call it */
2515-
VM_BUG_ON_PAGE(PageHuge(page), page);
2516-
2517-
if (likely(!PageTransCompound(page)))
2518-
return atomic_read(&page->_mapcount) + 1;
2519-
2520-
page = compound_head(page);
2521-
2522-
ret = 0;
2523-
for (i = 0; i < thp_nr_pages(page); i++) {
2524-
int mapcount = atomic_read(&page[i]._mapcount) + 1;
2525-
ret = max(ret, mapcount);
2526-
}
2527-
2528-
if (PageDoubleMap(page))
2529-
ret -= 1;
2530-
2531-
return ret + compound_mapcount(page);
2532-
}
2533-
25342486
/* Racy check whether the huge page can be split */
25352487
bool can_split_folio(struct folio *folio, int *pextra_pins)
25362488
{

0 commit comments

Comments
 (0)