Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Tony Luck and committed by
Borislav Petkov (AMD)
93d9fd89 0ec1db4c

+31 -11
+31 -11
fs/resctrl/rdtgroup.c
··· 3229 3229 } 3230 3230 3231 3231 /* 3232 - * Remove all subdirectories of mon_data of ctrl_mon groups 3233 - * and monitor groups for the given domain. 3234 - * Remove files and directories containing "sum" of domain data 3235 - * when last domain being summed is removed. 3232 + * Remove files and directories for one SNC node. If it is the last node 3233 + * sharing an L3 cache, then remove the upper level directory containing 3234 + * the "sum" files too. 3236 3235 */ 3237 - static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r, 3238 - struct rdt_domain_hdr *hdr) 3236 + static void rmdir_mondata_subdir_allrdtgrp_snc(struct rdt_resource *r, 3237 + struct rdt_domain_hdr *hdr) 3239 3238 { 3240 3239 struct rdtgroup *prgrp, *crgrp; 3241 3240 struct rdt_l3_mon_domain *d; 3242 3241 char subname[32]; 3243 - bool snc_mode; 3244 3242 char name[32]; 3245 3243 3246 3244 if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3)) 3247 3245 return; 3248 3246 3249 3247 d = container_of(hdr, struct rdt_l3_mon_domain, hdr); 3250 - snc_mode = r->mon_scope == RESCTRL_L3_NODE; 3251 - sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci_id : hdr->id); 3252 - if (snc_mode) 3253 - sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id); 3248 + sprintf(name, "mon_%s_%02d", r->name, d->ci_id); 3249 + sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id); 3254 3250 3255 3251 list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { 3256 3252 mon_rmdir_one_subdir(prgrp->mon.mon_data_kn, name, subname); 3257 3253 3258 3254 list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) 3259 3255 mon_rmdir_one_subdir(crgrp->mon.mon_data_kn, name, subname); 3256 + } 3257 + } 3258 + 3259 + /* 3260 + * Remove all subdirectories of mon_data of ctrl_mon groups 3261 + * and monitor groups for the given domain. 3262 + */ 3263 + static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r, 3264 + struct rdt_domain_hdr *hdr) 3265 + { 3266 + struct rdtgroup *prgrp, *crgrp; 3267 + char name[32]; 3268 + 3269 + if (r->rid == RDT_RESOURCE_L3 && r->mon_scope == RESCTRL_L3_NODE) { 3270 + rmdir_mondata_subdir_allrdtgrp_snc(r, hdr); 3271 + return; 3272 + } 3273 + 3274 + sprintf(name, "mon_%s_%02d", r->name, hdr->id); 3275 + list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { 3276 + kernfs_remove_by_name(prgrp->mon.mon_data_kn, name); 3277 + 3278 + list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) 3279 + kernfs_remove_by_name(crgrp->mon.mon_data_kn, name); 3260 3280 } 3261 3281 } 3262 3282