Re: [PATCH v11 20/31] fs/resctrl: Refactor Sub-NUMA Cluster (SNC) in mkdir/rmdir code flow
From: Reinette Chatre
Date: Thu Oct 09 2025 - 21:54:49 EST
Hi Tony,
On 10/9/25 6:14 PM, Luck, Tony wrote:
> On Thu, Oct 09, 2025 at 05:16:00PM -0700, Reinette Chatre wrote:
>> Hi Tony,
>>
>> On 10/9/25 3:08 PM, Luck, Tony wrote:
>>>> I did not mean to imply that this can be supported without refactoring. It does
>>>> seem as though you agree that mon_data::sum may be used for something
>>>> other than SNC and thus that using mon_data::sum as a check for SNC is not ideal.
>>>
>>> Reinette,
>>>
>>> Yes, we are in agreement about non-SNC future usage.
>>>
>>> Is it sufficient that I plant some WARN_ON_ONCE() in places where the
>>> code assumes that mon_data::sum is only used by RDT_RESOURCE_L3
>>> or for SNC?
>>
>> From what I understand this series does this already? I think this only applies to
>> rdtgroup_mondata_show() that does below ("L3 specific" comments added by me just for this example)
>> in this series:
>>
>> rdtgroup_mondata_show()
>> {
>> ...
>> if (md->sum) {
>> struct rdt_l3_mon_domain *d;
>>
>> if (WARN_ON_ONCE(resid != RDT_RESOURCE_L3)) {
>
> Exactly what I now have.
>> ...
> My "..." is:
> return -EINVAL;
>> }
>>
>> list_for_each_entry(d, &r->mon_domains, hdr.list) {
>> if (d->ci_id == domid) { /* L3 specific field */
>> ...
>> /* L3 specific */
>> ci = get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE);
>> }
>> }
>> ...
>> }
>>
>> This seems reasonable since the flow is different from the typical "check resource"
>> followed by a domain_header_is_valid() that a refactor to support another resource
>> would probably do as you state below.
>
> I looked around to see if there were any other places that needed this,
> but they all have checks for RDT_RESOURCE_L3 by the end of the series.
Thank you for checking. This seems like a good pattern to use consistently.
> I've added a check in __mon_event_count() in patch 13 that gets deleted
> in patch 18 when the L3 code is split out into a separate function.
>
>>>
>>> Such code can be fixed by future patches that want to use mon_data::sum
>>> for other things.
>>
>> This discussion digressed a bit. The discussion started with a request to add a check
>> for the L3 resource before calling rmdir_mondata_subdir_allrdtgrp_snc().
>> I see this as something like:
>> if (r->rid == RDT_RESOURCE_L3 && r->mon_scope == RESCTRL_L3_NODE) {
>
> I'll add this. Same is needed in mkdir_mondata_subdir().
>
Thank you very much.
Reinette