[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f02a7a8-9996-43e0-9f86-7d685f64f965@intel.com>
Date: Thu, 23 Oct 2025 10:45:35 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghuay@...dia.com>, "Maciej
Wieczor-Retman" <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 <yu.c.chen@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v12 21/31] fs/resctrl: Refactor
rmdir_mondata_subdir_allrdtgrp()
Hi Tony,
On 10/13/25 3:33 PM, Tony Luck wrote:
> rmdir_mondata_subdir_allrdtgrp() is complicated because of the support for
> Sub-NUMA Cluster (SNC) mode.
"rmdir_mondata_subdir_allrdtgrp()" -> "Clearing a monitor group's mon_data directory"?
>
> Refactor into a helper function for the SNC case to make it easier to add support
"Refactor into a helper function for the SNC case" -> "Refactor the SNC case into a helper function"?
> for a new telemetry resource.
>
> Suggested-by: Reinette Chatre <reinette.chatre@...el.com>
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
> fs/resctrl/rdtgroup.c | 41 +++++++++++++++++++++++++++++------------
> 1 file changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index b7eaa4388768..837279d97db4 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -3162,6 +3162,29 @@ static void mon_rmdir_one_subdir(struct kernfs_node *pkn, char *name, char *subn
> kernfs_remove_by_name(kn, subname);
> }
>
> +static void rmdir_mondata_subdir_allrdtgrp_snc(struct rdt_resource *r,
> + struct rdt_domain_hdr *hdr)
> +{
> + struct rdtgroup *prgrp, *crgrp;
> + struct rdt_l3_mon_domain *d;
> + char subname[32];
> + char name[32];
> +
> + if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
> + return;
> +
> + d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
> + sprintf(name, "mon_%s_%02d", r->name, d->ci_id);
> + sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id);
> +
> + list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
> + mon_rmdir_one_subdir(prgrp->mon.mon_data_kn, name, subname);
> +
> + list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
> + mon_rmdir_one_subdir(crgrp->mon.mon_data_kn, name, subname);
> + }
> +}
> +
> /*
> * Remove all subdirectories of mon_data of ctrl_mon groups
> * and monitor groups for the given domain.
> @@ -3172,25 +3195,19 @@ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
> struct rdt_domain_hdr *hdr)
This function's comments still mentions the actions needed to support SNC. Can this be
moved with the code?
> {
> struct rdtgroup *prgrp, *crgrp;
> - struct rdt_l3_mon_domain *d;
> - char subname[32];
> - bool snc_mode;
> char name[32];
>
> - if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
> + if (r->mon_scope == RESCTRL_L3_NODE) {
https://lore.kernel.org/lkml/aOhd_A5L8PV0OYba@agluck-desk3/
> + rmdir_mondata_subdir_allrdtgrp_snc(r, hdr);
> return;
> + }
>
> - d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
> - snc_mode = r->mon_scope == RESCTRL_L3_NODE;
> - sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci_id : d->hdr.id);
> - if (snc_mode)
> - sprintf(subname, "mon_sub_%s_%02d", r->name, d->hdr.id);
> -
> + sprintf(name, "mon_%s_%02d", r->name, hdr->id);
> list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
> - mon_rmdir_one_subdir(prgrp->mon.mon_data_kn, name, subname);
> + kernfs_remove_by_name(prgrp->mon.mon_data_kn, name);
>
> list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
> - mon_rmdir_one_subdir(crgrp->mon.mon_data_kn, name, subname);
> + kernfs_remove_by_name(crgrp->mon.mon_data_kn, name);
> }
> }
>
Reinette
Powered by blists - more mailing lists