Re: [PATCH v6 11/18] fs/resctrl: Introduce kmode_cpus/kmode_cpus_list per rdtgroup
From: Moger, Babu
Date: Fri Oct 16 2026 - 17:33:56 EST
Hi Reinette,
On 10/15/2026 10:31 AM, Reinette Chatre wrote:
Hi Babu,
On 10/1/26 8:10 AM, Babu Moger wrote:
The RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode allows tasks to use different
allocation and monitoring associations when transitioning from user mode to
Could "different allocation and monitoring associations" just be "different
CLOSID and RMID" (in places where this is what it refers to)? Being specific
and consistent with terms would make this so much easier to understand.
I avoided using CLOSID and RMID terms in filesystem specific code. If you are ok with that then I will use these terms.
kernel mode. The mode is enabled/disabled on a per-CPU basis.
Add kmode_cpus and kmode_cpus_list to display the CPUs associated with a
kernel mode. These files are exposed only when the global_enable_per_cpu
"a kernel mode" -> this is specific to RESCTRL_GLOBAL_ENABLE_PER_CPU kernel
mode node?
Sure.
This switches from "RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode" to
"global_enable_per_cpu mode" mid changelog.
Will change it.
mode is active.
Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
---
...> ---
fs/resctrl/internal.h | 2 ++
fs/resctrl/rdtgroup.c | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
index 986b9c942fb2..6b8d14c4bd83 100644
--- a/fs/resctrl/internal.h
+++ b/fs/resctrl/internal.h
@@ -216,6 +216,7 @@ struct mongroup {
* @mon: mongroup related data
* @mode: mode of resource group
* @mba_mbps_event: input monitoring event id when mba_sc is enabled
+ * @kmode_cpu_mask: CPUs in this group's kernel-mode association
Could there be a caveat that the value is only valid when the resource group
is backing the RESCTRL_GLOBAL_ENABLE_PER_CPU kernel mode?
Sure.
* @plr: pseudo-locked region
*/
struct rdtgroup {
@@ -229,6 +230,7 @@ struct rdtgroup {
struct mongroup mon;
enum rdtgrp_mode mode;
enum resctrl_event_id mba_mbps_event;
+ struct cpumask kmode_cpu_mask;
struct pseudo_lock_region *plr;
};
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 46b2cafd9411..0e638dc654c1 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -385,6 +385,31 @@ static int rdtgroup_cpus_show(struct kernfs_open_file *of,
return ret;
}
+/*
+ * Display CPU masks for the kernel-mode associated resource group.
nit: "masks for" -> "mask of"?
Sure.
+ * Supports both "kmode_cpus" (bitmap format) and "kmode_cpus_list"
+ * (range list format); the output format is selected accordingly.
+ *
+ * Returns -ENOENT on error.
+ */
+static int rdtgroup_kmode_cpus_show(struct kernfs_open_file *of,
+ struct seq_file *s, void *v)
+{
+ struct rdtgroup *rdtgrp;
+ int ret = 0;
+
+ rdtgrp = rdtgroup_kn_lock_live(of->kn);
+
+ if (!rdtgrp || rdtgrp != resctrl_kmode.rdtgrp)
Could the changelog please help reader understand the patches better?
For example, the additional "rdtgrp != resctrl_kmode.rdtgrp" check is
subtle but very important to maintain synchronization, but it is
never mentioned why this is used.
Will add a line in changelog about this check.
Thanks
Babu