fs/resctrl: Refactor rmdir_mondata_subdir_allrdtgrp()
Clearing a monitor group's mon_data directory is complicated because of the support for Sub-NUMA Cluster (SNC) mode. Refactor the SNC case into a helper function to make it easier to add support for a new telemetry resource. Suggested-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com
This commit is contained in:
parent
0ec1db4cac
commit
93d9fd8999
|
|
@ -3229,28 +3229,24 @@ static void mon_rmdir_one_subdir(struct kernfs_node *pkn, char *name, char *subn
|
|||
}
|
||||
|
||||
/*
|
||||
* Remove all subdirectories of mon_data of ctrl_mon groups
|
||||
* and monitor groups for the given domain.
|
||||
* Remove files and directories containing "sum" of domain data
|
||||
* when last domain being summed is removed.
|
||||
* Remove files and directories for one SNC node. If it is the last node
|
||||
* sharing an L3 cache, then remove the upper level directory containing
|
||||
* the "sum" files too.
|
||||
*/
|
||||
static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
|
||||
struct rdt_domain_hdr *hdr)
|
||||
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];
|
||||
bool snc_mode;
|
||||
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);
|
||||
snc_mode = r->mon_scope == RESCTRL_L3_NODE;
|
||||
sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci_id : hdr->id);
|
||||
if (snc_mode)
|
||||
sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id);
|
||||
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);
|
||||
|
|
@ -3260,6 +3256,30 @@ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove all subdirectories of mon_data of ctrl_mon groups
|
||||
* and monitor groups for the given domain.
|
||||
*/
|
||||
static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
|
||||
struct rdt_domain_hdr *hdr)
|
||||
{
|
||||
struct rdtgroup *prgrp, *crgrp;
|
||||
char name[32];
|
||||
|
||||
if (r->rid == RDT_RESOURCE_L3 && r->mon_scope == RESCTRL_L3_NODE) {
|
||||
rmdir_mondata_subdir_allrdtgrp_snc(r, hdr);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(name, "mon_%s_%02d", r->name, hdr->id);
|
||||
list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
|
||||
kernfs_remove_by_name(prgrp->mon.mon_data_kn, name);
|
||||
|
||||
list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
|
||||
kernfs_remove_by_name(crgrp->mon.mon_data_kn, name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a directory for a domain and populate it with monitor files. Create
|
||||
* summing monitors when @hdr is NULL. No need to initialize summing monitors.
|
||||
|
|
|
|||
Loading…
Reference in New Issue