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

From: Christoph Hellwig
Date: Tue Apr 06 2021 - 09:31:27 EST


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@xxxxxxxxxxxxx>
> ---
> 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@xxxxxx>