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

From: Juan Yescas

Date: Wed Aug 05 2026 - 21:19:06 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>
---

Changes in v2:
- Refactor the exit method.
- Release the page_alloc object.

mm/page_alloc_hogger.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/mm/page_alloc_hogger.c b/mm/page_alloc_hogger.c
index 6a6fbb78513a..72c0505a6f5a 100644
--- a/mm/page_alloc_hogger.c
+++ b/mm/page_alloc_hogger.c
@@ -591,6 +591,12 @@ 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_alloc_helper(idx);
+
debugfs_remove_recursive(mmdir);
kmem_cache_destroy(req_alloc_cache);
kmem_cache_destroy(page_alloc_cache);
--
2.55.0.629.g250fe7f194-goog