Re: [PATCH v1 05/26] mm: Add __free() support for __free_page()

Jonathan Cameron
2025-12-19T11:22:24Z

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

> Allow for the declaration of struct page * variables that trigger
> __free_page() when they go out of scope.
>
> Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
> include/linux/gfp.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index 0ceb4e09306c..dc61fa63a3b9 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -383,6 +383,7 @@ extern void free_pages_nolock(struct page *page, unsigned int order);
> extern void free_pages(unsigned long addr, unsigned int order);
>
> #define __free_page(page) __free_pages((page), 0)
> +DEFINE_FREE(__free_page, struct page *, if (_T) __free_page(_T))
> #define free_page(addr) free_pages((addr), 0)
>
> void page_alloc_init_cpuhp(void);