Skip to content

Commit

Permalink
mm: Add folio_estimated_mapcount()
Browse files Browse the repository at this point in the history
folio_estimated_mapcount() takes in a folio and calls page_mapcount() on
the first page of that folio.

This is necessary for folio conversions where we only care about either the
entire_mapcount of a large folio, or the mapcount of a not large folio.

This is in contrast to folio_mapcount() which calculates the total
number of the times a folio and its subpages are mapped.

Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
  • Loading branch information
VMoola authored and intel-lab-lkp committed Jan 24, 2023
1 parent be80ef2 commit 2ec1fab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/linux/mm.h
Expand Up @@ -913,6 +913,11 @@ static inline int page_mapcount(struct page *page)
return mapcount;
}

static inline int folio_estimated_mapcount(struct folio *folio)
{
return page_mapcount(folio_page(folio, 0));
}

int folio_total_mapcount(struct folio *folio);

/**
Expand Down

0 comments on commit 2ec1fab

Please sign in to comment.