From: "tip-bot2 for Tony Luck" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Reinette Chatre <reinette.chatre@intel.com>,
Tony Luck <tony.luck@intel.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cache] fs/resctrl: Refactor rmdir_mondata_subdir_allrdtgrp()
Date: Sat, 10 Jan 2026 19:45:58 -0000 [thread overview]
Message-ID: <176807435882.510.3454113946711939080.tip-bot2@tip-bot2> (raw)
The following commit has been merged into the x86/cache branch of tip:
Commit-ID: 93d9fd89995181d7ff420752328cc8b4b228f100
Gitweb: https://git.kernel.org/tip/93d9fd89995181d7ff420752328cc8b4b228f100
Author: Tony Luck <tony.luck@intel.com>
AuthorDate: Wed, 17 Dec 2025 09:21:09 -08:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Fri, 09 Jan 2026 23:02:58 +01:00
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
---
fs/resctrl/rdtgroup.c | 42 +++++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 6314819..57139f9 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -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);
@@ -3261,6 +3257,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.
*/
reply other threads:[~2026-01-10 19:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176807435882.510.3454113946711939080.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®