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

Xu Yilun
2025-11-17T02:38:13Z

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>
---
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);
--
2.25.1