[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e536ea0b-c466-4381-b92b-993be92fe65e@intel.com>
Date: Wed, 8 Oct 2025 19:16:07 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: "Luck, Tony" <tony.luck@...el.com>
CC: Fenghua Yu <fenghuay@...dia.com>, "Wieczor-Retman, Maciej"
<maciej.wieczor-retman@...el.com>, Peter Newman <peternewman@...gle.com>,
James Morse <james.morse@....com>, Babu Moger <babu.moger@....com>, "Drew
Fustini" <dfustini@...libre.com>, Dave Martin <Dave.Martin@....com>, "Chen,
Yu C" <yu.c.chen@...el.com>, "x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"patches@...ts.linux.dev" <patches@...ts.linux.dev>
Subject: Re: [PATCH v11 20/31] fs/resctrl: Refactor Sub-NUMA Cluster (SNC) in
mkdir/rmdir code flow
Hi Tony,
On 10/8/25 3:29 PM, Luck, Tony wrote:
>>> static int mkdir_mondata_subdir(struct kernfs_node *parent_kn,
>>> struct rdt_domain_hdr *hdr,
>>> struct rdt_resource *r, struct rdtgroup *prgrp)
>>> {
>>> lockdep_assert_held(&rdtgroup_mutex);
>>>
>>> if (r->mon_scope == RESCTRL_L3_NODE)
>>> return mkdir_mondata_subdir_snc(parent_kn, hdr, r, prgrp);
>>>
>>> ... pruned version of original code without SNC bits ...
>>> }
>>>
>>> and:
>>>
>>> static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
>>> struct rdt_domain_hdr *hdr)
>>> {
>>> if (r->mon_scope == RESCTRL_L3_NODE) {
>>> rmdir_mondata_subdir_allrdtgrp_snc(r, hdr);
>>> return;
>>> }
>>>
>>> ... pruned version of original code without SNC bits ...
>>> }
>>
>> Indeed, this will keep the functions generic in the sense that it operates
>> on all resource types. This looks good since I think once the SNC code is taken
>> what remains should be easy to follow.
>> I think it may also help to (in addition to the mon_scope check) add a RDT_RESOURCE_L3
>> check before the SNC code to keep the pattern that SNC only applies to the L3 resource.
>
> Reinette,
>
> The SNC versions to make and remove directories need to get the rdt_l3_mon_domain from
> hdr. So they both begin with the standard:
>
> if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
> return -EINVAL;
>
> d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
>
> [though rmdir function returns void, so doesn't have that "-EINVAL".]
Understood. This is not about correctness but making the code easier to understand.
What I am aiming for is consistency in the code where the pattern
in existing flows use the resource ID as check to direct code flow to resource
specific code. In the above flow it uses the monitoring scope. This works of course,
but it is an implicit check because the L3 resource is the only one that currently
supports the "node" scope and does so when SNC is enabled.
My preference is for the code to be consistent in patterns used and find doing so
makes the code easier to read and understand.
Reinette
Powered by blists - more mailing lists