Re: [PATCH v3 3/3] fs/resctrl: Allocate rdt_l3_mon_domain::rmid_busy_llc using kvzalloc_objs()
From: Jinjie Ruan
Date: Thu Nov 26 2026 - 01:46:04 EST
在 2026/11/26 0:47, Ben Horgan 写道:
> The bitmap rdt_l3_mon_domain::rmid_busy_llc has
> resctrl_arch_system_num_rmid_idx() entries. On an MPAM system this 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
> approaching these limits the kmalloc() based allocation will consistently fail
> and hence fail to bring the monitor domain online.
>
> As there is no equivalent to bitmap_zalloc() that uses kvmalloc() or vmalloc(),
> open code the allocation of rmid_busy_llc 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@xxxxxxx>
> ---
> fs/resctrl/rdtgroup.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index c55f125ce9a1..a8eebb5a5c4b 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -4503,7 +4503,7 @@ static void domain_destroy_l3_mon_state(struct rdt_l3_mon_domain *d)
> int idx;
>
> kvfree(d->cntr_cfg);
> - bitmap_free(d->rmid_busy_llc);
> + kvfree(d->rmid_busy_llc);
> for_each_mbm_idx(idx) {
> kvfree(d->mbm_states[idx]);
> d->mbm_states[idx] = NULL;
> @@ -4624,7 +4624,7 @@ static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3_mon_d
> int idx;
>
> if (resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) {
> - d->rmid_busy_llc = bitmap_zalloc(idx_limit, GFP_KERNEL);
> + d->rmid_busy_llc = kvzalloc_objs(unsigned long, BITS_TO_LONGS(idx_limit));
LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
> if (!d->rmid_busy_llc)
> return -ENOMEM;
> }
> @@ -4646,7 +4646,7 @@ static int domain_setup_l3_mon_state(struct rdt_resource *r, struct rdt_l3_mon_d
>
> return 0;
> cleanup:
> - bitmap_free(d->rmid_busy_llc);
> + kvfree(d->rmid_busy_llc);
> for_each_mbm_idx(idx) {
> kvfree(d->mbm_states[idx]);
> d->mbm_states[idx] = NULL;