Re: [PATCH v5 04/16] fs/resctrl: Introduce kernel mode policy enum

From: Babu Moger

Date: Wed Sep 16 2026 - 17:29:26 EST


Hi Reinette,

On 9/16/26 00:14, Reinette Chatre wrote:
Hi Babu,

On 8/26/26 12:32 PM, Babu Moger wrote:
Kernel mode traffic can use different allocation and monitoring

"traffic" -> "work" to not imply this is just about memory traffic but
also includes cache allocation?

Sure.


associations than the originating user task. On x86, Privilege Level Zero
Association (PLZA) enables the kernel to switch to a different CLOSID/RMID
when entering kernel mode.

Architectures need a common way to name kernel modes before resctrl
can report what is active or what the platform supports.

Introduce enum resctrl_kernel_mode:
- RESCTRL_INHERIT_USER: Kernel mode inherits allocation and monitoring
from the user task.
- RESCTRL_ASSIGN_GLOBAL_ENABLE_PER_CPU: Kernel mode may use allocation
and/or monitoring associations that differ from the user task. On x86,
CLOSID and RMID can be configured independently for kernel mode.

Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
---

...

---
include/linux/resctrl.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index dd09c2ce9a0f..4245d1e65ccc 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -704,6 +704,31 @@ int resctrl_arch_io_alloc_enable(struct rdt_resource *r, bool enable);
*/
bool resctrl_arch_get_io_alloc_enabled(struct rdt_resource *r);
+/**
+ * enum resctrl_kernel_mode - Kernel mode control and monitoring association.
+ *
+ * @RESCTRL_INHERIT_USER:
+ * Kernel mode inherits both allocation and monitoring associations
+ * from the user space task. On x86, kernel uses the same CLOSID and
+ * RMID as the user-space task.
+ *
+ * @RESCTRL_ASSIGN_GLOBAL_ENABLE_PER_CPU:
+ * Kernel mode may use allocation and monitoring associations that

Why is this "may use"? Could this be made more accurate? Consider, for
example:
All kernel mode work uses the same allocation and/or monitoring
association via an assigned CTRL_MON or MON group. The mode can
be enabled/disabled per-CPU. When the mode is disabled on a CPU
then the kernel work on that CPU inherits the allocation and
monitoring association from the user space task, effectively the
kernel mode becomes RESCTRL_INHERIT_USER on that CPU.


Sure. Thanks.


+ * differ from the user task. On x86, CLOSID and RMID are configured
+ * independently; either or both may differ from user mode.

Please first provide all details that support what resctrl fs exposes to
user space before, if at all, adding any x86 specific details.

Sure.

+ *
+ * All online CPUs are included by default. A subset may be selected
+ * through the resctrl group interface, and a CTRL_MON or MON group
+ * may be associated with this mode.

Please note that the word "associated" appears in multiple contexts here.

"assigned" might work better here.


+ */
+enum resctrl_kernel_mode {
+ RESCTRL_INHERIT_USER,
+ RESCTRL_ASSIGN_GLOBAL_ENABLE_PER_CPU,

Something that stands out in this series is the multiple occurrences of
"assigned" in the new interface. What do you think of just dropping
"assign" from the kernel mode name?

Actually, I was thinking about shortening the name here.

Let's remove "assign" from here.

Thanks
Babu
.