[RFC PATCH v2 02/16] mm: Define structs for allocation requests and store allocations

From: Juan Yescas

Date: Wed Aug 05 2026 - 21:14:04 EST


This change introduces the next structs:

- struct req_alloc to keep the request info for the allocation.

- struct page_alloc to store a pointer to the page that was
allocated, the request info and the file that represents this
allocation. This file will be used to free the allocation when
it is not longer needed.

Signed-off-by: Juan Yescas <jyescas@xxxxxxxxxx>
---

Changes in v2:
- Fix comment block. Add an extra * at the beginning.

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

diff --git a/mm/page_alloc_hogger.c b/mm/page_alloc_hogger.c
index 1d31e981920e..caeb2e5e8579 100644
--- a/mm/page_alloc_hogger.c
+++ b/mm/page_alloc_hogger.c
@@ -91,6 +91,34 @@

static struct dentry *mmdir;

+/**
+ * struct req_alloc - Represents the requested allocation
+ * @node_idx: The Node index to allocate from.
+ * @zone_idx: The Zone index to allocate from.
+ * @order: The Order of pages to allocate.
+ * @migrate_type: The Migrate type to allocate from.
+ * @parentdir: The parent dir where the file representing the alloc was created.
+ */
+struct req_alloc {
+ int node_idx;
+ int zone_idx;
+ int order;
+ int migrate_type;
+ struct dentry *parentdir;
+};
+
+/**
+ * struct page_alloc - Represents the page allocation.
+ * @page: The pointer to the page(s) allocated.
+ * @req_alloc: The details of the allocation.
+ * @alloc_dentry: The pointer to the file that represents the allocation.
+ */
+struct page_alloc {
+ struct page *page;
+ struct req_alloc *req_alloc;
+ struct dentry *alloc_dentry;
+};
+
static int __init page_alloc_hogger_debugfs_init(void)
{
mmdir = debugfs_create_dir("mm", NULL);
--
2.55.0.629.g250fe7f194-goog