mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Ben Horgan <ben.horgan@arm.com>, <tony.luck@intel.com>,
	<reinette.chatre@intel.com>, <Dave.Martin@arm.com>,
	<james.morse@arm.com>, <babu.moger@amd.com>, <bp@alien8.de>,
	<tan.shaopeng@fujitsu.com>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs/resctrl: Allocate the RMID array with kvzalloc
Date: Thu, 5 Nov 2026 15:51:14 +0800	[thread overview]
Message-ID: <52c306ab-5378-496b-a759-27bbc0b6e55e@huawei.com> (raw)
In-Reply-To: <8a543030-d0c1-416f-8747-6cd599ad6a90@arm.com>



在 2026/11/4 18:51, Ben Horgan 写道:
> Hi Jinjie,
> 
> On 04/11/2026 10:20, Jinjie Ruan wrote:
>> 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().
> 
> Yep, I ran into this too when experimenting with large PARTID counts on the FVP model. I have the
> same patch here [1] and plan to repost soon with some more related kmalloc to kvmalloc changes.

Hi Ben,

Sorry, next time before sending, I will carefully check the email list.
Thank you for the review.

> 
> [1] https://lore.kernel.org/lkml/20260911160608.1091121-1-ben.horgan@arm.com/
> 
> Thanks,
> 
> Ben
> 
>>
>> Fixes: 6791e0ea3071 ("x86/resctrl: Access per-rmid structures by index")
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> Cc: <stable@vger.kernel.org> # 7.1.x
>> Cc: Tony Luck <tony.luck@intel.com>
>> Cc: Reinette Chatre <reinette.chatre@intel.com>
>> Cc: Dave Martin <Dave.Martin@arm.com>
>> Cc: James Morse <james.morse@arm.com>
>> Cc: Babu Moger <babu.moger@amd.com>
>> ---
>>  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);
>>  }
> 

-- 
Best regards,
Jinjie


      reply	other threads:[~2026-11-05  7:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 10:20 Jinjie Ruan
2026-11-04 10:51 ` Ben Horgan
2026-11-05  7:51   ` Jinjie Ruan [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=52c306ab-5378-496b-a759-27bbc0b6e55e@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=tan.shaopeng@fujitsu.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®