Re: [PATCH v10 16/33] mm: Add folio_mapcount

From: Matthew Wilcox
Date: Tue May 18 2021 - 14:46:27 EST


On Tue, May 11, 2021 at 10:47:18PM +0100, Matthew Wilcox (Oracle) wrote:
> This is the folio equivalent of page_mapcount().
[...]
>
> +/**
> + * folio_mapcount - The number of mappings of this folio.
> + * @folio: The folio.
> + *
> + * The result includes the number of times any of the pages in the
> + * folio are mapped to userspace.

I thought it did, but it doesn't. It returns the number of times
the head/base page of this folio is mapped into userspace, which is not
a terribly useful concept. I suspect this should call total_mapcount()
instead. Looking through the complete set of patches, it's only used
in debugging code (unaccount_page_cache_page() and dump_page()).
I'm going to withdraw this patch from the next submission until I've
had the chance to think about it some more.