mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
mm: convert page_mapcount() to use folio_entire_mapcount()
Remove a use of head_compound_mapcount(). Link: https://lkml.kernel.org/r/20230111142915.1001531-15-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
46f2722825
commit
c97eeb8f26
@@ -853,22 +853,26 @@ static inline void page_mapcount_reset(struct page *page)
|
|||||||
atomic_set(&(page)->_mapcount, -1);
|
atomic_set(&(page)->_mapcount, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Mapcount of 0-order page; when compound sub-page, includes
|
* page_mapcount() - Number of times this precise page is mapped.
|
||||||
* compound_mapcount of compound_head of page.
|
* @page: The page.
|
||||||
*
|
*
|
||||||
* Result is undefined for pages which cannot be mapped into userspace.
|
* The number of times this page is mapped. If this page is part of
|
||||||
|
* a large folio, it includes the number of times this page is mapped
|
||||||
|
* as part of that folio.
|
||||||
|
*
|
||||||
|
* The result is undefined for pages which cannot be mapped into userspace.
|
||||||
* For example SLAB or special types of pages. See function page_has_type().
|
* For example SLAB or special types of pages. See function page_has_type().
|
||||||
* They use this place in struct page differently.
|
* They use this field in struct page differently.
|
||||||
*/
|
*/
|
||||||
static inline int page_mapcount(struct page *page)
|
static inline int page_mapcount(struct page *page)
|
||||||
{
|
{
|
||||||
int mapcount = atomic_read(&page->_mapcount) + 1;
|
int mapcount = atomic_read(&page->_mapcount) + 1;
|
||||||
|
|
||||||
if (likely(!PageCompound(page)))
|
if (unlikely(PageCompound(page)))
|
||||||
return mapcount;
|
mapcount += folio_entire_mapcount(page_folio(page));
|
||||||
page = compound_head(page);
|
|
||||||
return head_compound_mapcount(page) + mapcount;
|
return mapcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int folio_total_mapcount(struct folio *folio);
|
int folio_total_mapcount(struct folio *folio);
|
||||||
|
|||||||
Reference in New Issue
Block a user