[PATCH RFC v4 06/18] fs/resctrl: Let bandwidth resources default to min_bw at reset
Drew Fustini
fustini at kernel.org
Sun May 10 22:11:02 PDT 2026
Bandwidth resources reset to max_bw on group creation today, which is
the right default for MBA and SMBA. However, it is the wrong default for
hardware whose registers form a sum-constrained reservation: defaulting
every new group to max_bw would immediately violate the sum on the first
mkdir.
When default_to_min is set, resctrl_get_default_ctrl() returns min_bw
for the resource. The existing MBA and SMBA behavior is not changed.
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Drew Fustini <fustini at kernel.org>
---
include/linux/resctrl.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 9529ed0d1fdf..bcbc166412ef 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -247,7 +247,13 @@ enum membw_throttle_mode {
/**
* struct resctrl_membw - Memory bandwidth allocation related data
* @min_bw: Minimum memory bandwidth percentage user can request
- * @max_bw: Maximum memory bandwidth value, used as the reset value
+ * @max_bw: Maximum memory bandwidth value a group can be
+ * configured with
+ * @default_to_min: When true, the default control value for new
+ * groups and reset is @min_bw instead of @max_bw.
+ * Drivers whose hardware enforces a sum constraint
+ * across groups (e.g. CBQRI MB_MIN) set this so
+ * mkdir does not overflow the sum.
* @bw_gran: Granularity at which the memory bandwidth is allocated
* @delay_linear: True if memory B/W delay is in linear scale
* @arch_needs_linear: True if we can't configure non-linear resources
@@ -259,6 +265,7 @@ enum membw_throttle_mode {
struct resctrl_membw {
u32 min_bw;
u32 max_bw;
+ bool default_to_min;
u32 bw_gran;
u32 delay_linear;
bool arch_needs_linear;
@@ -405,7 +412,7 @@ static inline u32 resctrl_get_default_ctrl(struct rdt_resource *r)
case RESCTRL_SCHEMA_BITMAP:
return BIT_MASK(r->cache.cbm_len) - 1;
case RESCTRL_SCHEMA_RANGE:
- return r->membw.max_bw;
+ return r->membw.default_to_min ? r->membw.min_bw : r->membw.max_bw;
}
return WARN_ON_ONCE(1);
--
2.43.0
More information about the linux-riscv
mailing list