[PATCH] fs/resctrl: Allocate the RMID array with kvzalloc
From: Jinjie Ruan
Date: Wed Nov 04 2026 - 05:20:31 EST
setup_rmid_lru_list() sizes rmid_ptrs[] by the whole RMID index space.
On x86 the index is the RMID, so the array stays small. On MPAM the
index space is the product of the PARTID and PMG ranges, and with a
large range the array is megabytes in size.
kzalloc() needs a high-order page allocation for it, which fails once
memory is fragmented, and a size above KMALLOC_MAX_SIZE always fails.
resctrl then fails to mount.
Use kvzalloc(), which falls back to vmalloc().
Fixes: 6791e0ea3071 ("x86/resctrl: Access per-rmid structures by index")
Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 7.1.x
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Reinette Chatre <reinette.chatre@xxxxxxxxx>
Cc: Dave Martin <Dave.Martin@xxxxxxx>
Cc: James Morse <james.morse@xxxxxxx>
Cc: Babu Moger <babu.moger@xxxxxxx>
---
fs/resctrl/monitor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index f69dbf66f42e..7713aa5d3996 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -1029,7 +1029,7 @@ int setup_rmid_lru_list(void)
return 0;
idx_limit = resctrl_arch_system_num_rmid_idx();
- rmid_ptrs = kzalloc_objs(struct rmid_entry, idx_limit);
+ rmid_ptrs = kvzalloc_objs(struct rmid_entry, idx_limit);
if (!rmid_ptrs)
return -ENOMEM;
@@ -1125,7 +1125,7 @@ void free_rmid_lru_list(void)
return;
mutex_lock(&rdtgroup_mutex);
- kfree(rmid_ptrs);
+ kvfree(rmid_ptrs);
rmid_ptrs = NULL;
mutex_unlock(&rdtgroup_mutex);
}
--
2.34.1