Re: [PATCH v6 3/3] fs/resctrl: Factor MBA parse-time conversion to be per-arch

From: Gavin Shan

Date: Mon Sep 14 2026 - 02:03:36 EST


On 9/12/26 2:36 AM, Ben Horgan wrote:
From: Dave Martin <dave.martin@xxxxxxx>

The control value parser for the MB resource currently coerces the memory
bandwidth percentage value from userspace to be an exact multiple of the
rdt_resource::resctrl_membw::bw_gran parameter.

On MPAM systems, this results in somewhat worse-than-worst-case rounding, since
the bandwidth granularity advertised to resctrl by the MPAM driver is in general
only an approximation to the actual hardware granularity on these systems, and
the hardware bandwidth allocation control value is not natively a percentage --
necessitating a further conversion in the resctrl_arch_update_domains() path,
regardless of the conversion done at parse time.

For MPAM and x86 use their custom pre-prepared parse-time conversion,
resctrl_arch_preconvert_bw(). This will avoid accumulated error from rounding
the value twice on MPAM systems. For x86 systems there is no functional change.

Clarify the documentation, but avoid overly exact promises.

Clamping to bw_min and bw_max still feels generic: leave it in the core code,
for now.

[ BH: Split out x86 specific changes ]
Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx>
Signed-off-by: Ben Horgan <Ben.Horgan@xxxxxxx>
Reviewed-by: Ben Horgan <ben.horgan@xxxxxxx>
Reviewed-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
---
Changes since v3:
Parameter order swap (Reinette)
Reflow commit message to use 80 characters (Reinette)
Adjust comment line length (Reinette)
Add Reinette's R-b

Changes since v4:
Make Dave the author as he wrote the patch

Changes since v5:
Document that the rounding can be up or down
---
Documentation/filesystems/resctrl.rst | 17 +++++++++--------
fs/resctrl/ctrlmondata.c | 6 +++---
2 files changed, 12 insertions(+), 11 deletions(-)


Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>