Re: [PATCH v1 14/26] mm: Add __free() support for folio_put()

Jonathan Cameron
2025-12-19T11:55:11Z

On Mon, 17 Nov 2025 10:22:58 +0800
Xu Yilun <yilun.xu@linux.intel.com> wrote:

> Allow for the declaration of struct folio * variables that trigger
> folio_put() when they go out of scope.
>
> Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
> ---
> include/linux/mm.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index d16b33bacc32..2456bb775e27 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1425,6 +1425,8 @@ static inline void folio_put(struct folio *folio)
> __folio_put(folio);
> }
>
> +DEFINE_FREE(folio_put, struct folio *, if (_T) folio_put(_T))

Seems like a reasonable addition to me.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> +
> /**
> * folio_put_refs - Reduce the reference count on a folio.
> * @folio: The folio.