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

Juan Yescas <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm,gmane.linux.kernel.mm
Message-ID <[email protected]>
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 <[email protected]>
---

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.