[RFC PATCH 16/16] mm: Release resources when the page alloc hogger module exits

From: Juan Yescas

Date: Thu Jul 23 2026 - 04:00:35 EST


When the page alloc hogger module exits:

- free all the previously allocated pages
- Erase all the entries from the xarray

Signed-off-by: Juan Yescas <jyescas@xxxxxxxxxx>
---
mm/page_alloc_hogger.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/mm/page_alloc_hogger.c b/mm/page_alloc_hogger.c
index 5fe9c545e884..f554bbb4afa7 100644
--- a/mm/page_alloc_hogger.c
+++ b/mm/page_alloc_hogger.c
@@ -590,6 +590,14 @@ static int __init page_alloc_hogger_debugfs_init(void)

static void __exit page_alloc_hogger_debugfs_exit(void)
{
+ struct page_alloc *pa;
+ unsigned long idx;
+
+ xa_for_each(&allocs_xa, idx, pa) {
+ __free_pages(pa->page, pa->req_alloc->order);
+ xa_erase(&allocs_xa, idx);
+ }
+
debugfs_remove_recursive(mmdir);
kmem_cache_destroy(req_alloc_cache);
kmem_cache_destroy(page_alloc_cache);
--
2.55.0.229.g6434b31f56-goog