Re: [PATCH v6 05/27] mm: Add folio reference count functions

Christoph Hellwig
2021-04-06T13:31:27Z

On Wed, Mar 31, 2021 at 07:47:06PM +0100, Matthew Wilcox (Oracle) wrote:
> These functions mirror their page reference counterparts.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> Documentation/core-api/mm-api.rst | 1 +
> include/linux/page_ref.h | 88 ++++++++++++++++++++++++++++++-
> 2 files changed, 88 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst
> index 34f46df91a8b..1ead2570b217 100644
> --- a/Documentation/core-api/mm-api.rst
> +++ b/Documentation/core-api/mm-api.rst
> @@ -97,3 +97,4 @@ More Memory Management Functions
> :internal:
> .. kernel-doc:: include/linux/mm.h
> :internal:
> +.. kernel-doc:: include/linux/page_ref.h
> diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h
> index f3318f34fc54..f27005e760fd 100644
> --- a/include/linux/page_ref.h
> +++ b/include/linux/page_ref.h
> @@ -69,7 +69,29 @@ static inline int page_ref_count(struct page *page)
>
> static inline int page_count(struct page *page)
> {
> - return atomic_read(&compound_head(page)->_refcount);
> + return page_ref_count(compound_head(page));
> +}

I don't think this change belongs in here. It seems useful though,
so maybe split it into a standalone patch?

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>