From: Ben Horgan <ben.horgan@arm.com>
Cc: tony.luck@intel.com, reinette.chatre@intel.com, x86@kernel.org,
Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com,
fenghuay@nvidia.com, bp@alien8.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] fs/resctrl: Allocate rdt_l3_mon_domain::rmid_busy_llc using kvzalloc_objs()
Date: Wed, 2 Dec 2026 11:25:09 +0000 [thread overview]
Message-ID: <146269e3-c4ce-4fa1-bedc-79bfc5dddd8e@arm.com> (raw)
In-Reply-To: <e188fb80-e28a-446a-9440-e4f0e9c98828@arm.com>
On 02/12/2026 09:59, Ben Horgan wrote:
> Replying to myself...
>
> On 25/11/2026 16:47, Ben Horgan wrote:
>> 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
>
> I chatted to James offline about this and he suggested that even if resctrl is the only user of a kvmalloc() based
> bitmap allocation that I should make some helpers that could be used verbatim in the bitmap core code even if they at
> first start life in resctrl. I'll also do some better searching to see if they would be useful elsewhere.
Looks there are some more places the helpers would be useful.
linux$ git grep 'kv.*alloc.*BITS_TO_LONGS'
drivers/md/dm-pcache/cache.c: cache->seg_map = kvcalloc(BITS_TO_LONGS(cache_dev->seg_num), sizeof(unsigned long),
GFP_KERNEL);
drivers/md/dm-pcache/cache_dev.c: cache_dev->seg_bitmap = kvcalloc(BITS_TO_LONGS(cache_dev->seg_num),
sizeof(unsigned long), GFP_KERNEL);
drivers/md/dm-verity-target.c: v->validated_blocks = kvcalloc(BITS_TO_LONGS(v->data_blocks),
drivers/net/ethernet/mellanox/mlx5/core/fs_pool.c: fs_bulk->bitmask = kvcalloc(BITS_TO_LONGS(fs_bulk->bulk_len),
fs/verity/open.c: vi->hash_block_verified = kvcalloc(BITS_TO_LONGS(num_bits),
fs/xfs/xfs_zone_alloc.c: return kvmalloc_array(BITS_TO_LONGS(mp->m_sb.sb_rgcount),
kernel/bpf/verifier.c: env->callx_edges = kvcalloc(BITS_TO_LONGS(cnt * cnt), sizeof(long),
lib/region_alloc_benchmark.c: bitmap = kvmalloc_array(BITS_TO_LONGS(max_cap), sizeof(*bitmap), GFP_KERNEL);
Thanks,
Ben
(The arm64
> asid has large bitmaps that don't need to physically contiguous but these allocated once at boot so we've already got
> more problems if those allocations are failing.)
>
> I'll re-spin with some proper helpers which I'll call bitmap_kvzalloc() and bitmap_kvfree() unless anyone has any better
> ideas.
>
> Thanks,
>
> BEn
>
>> 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>
>> ---
>> 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));
>> 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;
>
prev parent reply other threads:[~2026-12-02 11:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 16:47 [PATCH v3 0/3] fs/resctrl: Use kvzalloc_objs() for large allocations Ben Horgan
2026-11-25 16:47 ` [PATCH v3 1/3] fs/resctrl: Allocate rmid_ptrs[] using kvzalloc_objs() Ben Horgan
2026-11-26 6:39 ` Jinjie Ruan
2026-11-25 16:47 ` [PATCH v3 2/3] fs/resctrl: Allocate the arrays in struct rdt_l3_mon_domain " Ben Horgan
2026-11-26 6:43 ` Jinjie Ruan
2026-11-25 16:47 ` [PATCH v3 3/3] fs/resctrl: Allocate rdt_l3_mon_domain::rmid_busy_llc " Ben Horgan
2026-11-26 6:45 ` Jinjie Ruan
2026-12-02 9:59 ` Ben Horgan
2026-12-02 11:25 ` Ben Horgan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=146269e3-c4ce-4fa1-bedc-79bfc5dddd8e@arm.com \
--to=ben.horgan@arm.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=fenghuay@nvidia.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®