* [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs()
@ 2026-09-11 16:06 Ben Horgan
2026-09-16 9:26 ` Ben Horgan
2026-09-16 16:52 ` Reinette Chatre
0 siblings, 2 replies; 3+ messages in thread
From: Ben Horgan @ 2026-09-11 16:06 UTC (permalink / raw)
To: ben.horgan
Cc: tony.luck, reinette.chatre, x86, Dave.Martin, james.morse,
babu.moger, fenghuay, bp, linux-kernel
On an MPAM system the number of entries in rmid_ptrs[] is the number of PARTIDs
multiplied by the number of PMGs. The maximum possible number of PARTIDs is
0x10000 and the maximum number of PMGs is 0x100. On a system pushing the limits
of the MPAM specification this can be large enough to consistently fail the
kzalloc_objs() allocation and hence fail to mount the resctrl filesystem.
Switch to allocating rmid_ptrs[] using kvzalloc_objs() so that large allocations
fall back to vmalloc().
Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
---
I found this by testing the extremes of a software model and don't expect this
to effect real systems.
---
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 73413cb128ea..2d7df60973d1 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -979,7 +979,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;
@@ -1010,7 +1010,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.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs()
2026-09-11 16:06 [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs() Ben Horgan
@ 2026-09-16 9:26 ` Ben Horgan
2026-09-16 16:52 ` Reinette Chatre
1 sibling, 0 replies; 3+ messages in thread
From: Ben Horgan @ 2026-09-16 9:26 UTC (permalink / raw)
To: ben.horgan
Cc: tony.luck, reinette.chatre, x86, Dave.Martin, james.morse,
babu.moger, fenghuay, bp, linux-kernel
I realised I forgot to include a changelog with this v2. The only change from v1 is an update to the
fixes tag as suggested by Reinette.
Thanks,
Ben
On 11/09/2026 17:06, Ben Horgan wrote:
> On an MPAM system the number of entries in rmid_ptrs[] is the number of PARTIDs
> multiplied by the number of PMGs. The maximum possible number of PARTIDs is
> 0x10000 and the maximum number of PMGs is 0x100. On a system pushing the limits
> of the MPAM specification this can be large enough to consistently fail the
> kzalloc_objs() allocation and hence fail to mount the resctrl filesystem.
>
> Switch to allocating rmid_ptrs[] using kvzalloc_objs() so that large allocations
> fall back to vmalloc().
>
> Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> Reviewed-by: Tony Luck <tony.luck@intel.com>
> ---
> I found this by testing the extremes of a software model and don't expect this
> to effect real systems.
> ---
> 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 73413cb128ea..2d7df60973d1 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -979,7 +979,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;
>
> @@ -1010,7 +1010,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);
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs()
2026-09-11 16:06 [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs() Ben Horgan
2026-09-16 9:26 ` Ben Horgan
@ 2026-09-16 16:52 ` Reinette Chatre
1 sibling, 0 replies; 3+ messages in thread
From: Reinette Chatre @ 2026-09-16 16:52 UTC (permalink / raw)
To: Ben Horgan
Cc: tony.luck, x86, Dave.Martin, james.morse, babu.moger, fenghuay,
bp, linux-kernel
Hi Ben,
On 9/11/26 9:06 AM, Ben Horgan wrote:
> On an MPAM system the number of entries in rmid_ptrs[] is the number of PARTIDs
> multiplied by the number of PMGs. The maximum possible number of PARTIDs is
> 0x10000 and the maximum number of PMGs is 0x100. On a system pushing the limits
> of the MPAM specification this can be large enough to consistently fail the
> kzalloc_objs() allocation and hence fail to mount the resctrl filesystem.
>
> Switch to allocating rmid_ptrs[] using kvzalloc_objs() so that large allocations
> fall back to vmalloc().
>
> Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
> Signed-off-by: Ben Horgan <ben.horgan@arm.com>
> Reviewed-by: Tony Luck <tony.luck@intel.com>
> ---
> I found this by testing the extremes of a software model and don't expect this
> to effect real systems.
> ---
> 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 73413cb128ea..2d7df60973d1 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -979,7 +979,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;
>
resctrl_arch_system_num_rmid_idx() that guides the rmid_ptrs[] allocation is
also used to size the L3 monitoring state rdt_l3_mon_domain::rmid_busy_llc[]
and rdt_l3_mon_domain::mbm_states[]. Each RMID is expected to have associated
states in these structures so to fully support this their allocation needs
to change also? I did a quick check and there does not seem to be a
vmalloc variant for bitmap allocation though so that may need to be
customized or created.
Reinette
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-16 16:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 16:06 [PATCH v2] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs() Ben Horgan
2026-09-16 9:26 ` Ben Horgan
2026-09-16 16:52 ` Reinette Chatre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®