Re: [RFC PATCH 1/3] fs/resctrl: Add schema_name to struct resctrl_ctrl

From: Drew Fustini

Date: Tue Sep 22 2026 - 16:16:57 EST


On Mon, Sep 21, 2026 at 02:57:00PM +0100, Ben Horgan wrote:
> In order to properly align the schema in the schemata and size file the
> maximum of length of all the schema names needs to be
> known. resctrl_resource_ctrl_max_len() makes this calculation but stops
> short of actually constructing and storing the schema names. As the schema
> name is based on the resource name and the schema name with some special
> cases for legacy controls this leads to a lot of conditional formatting
> when displaying the schema name.
>
> Construct the schema name and save it to struct resctrl when mounting
> resctrl. This makes displaying the schema name easy whilst control of the
> naming stays within resctrl.
>
> Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>
> ---
> fs/resctrl/ctrlmondata.c | 51 ++++++-----------------------
> fs/resctrl/rdtgroup.c | 69 +++++++++++++++++++++++++---------------
> include/linux/resctrl.h | 1 +
> 3 files changed, 55 insertions(+), 66 deletions(-)
>
> diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
[..]
> @@ -638,18 +608,17 @@ int rdtgroup_schemata_show(struct kernfs_open_file *of,
> if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
> list_for_each_entry(f, &rdt_resource_final_all, list) {
> for_each_enabled_ctrl(ctrl, f->res)
> - seq_printf(s, "%s%s%s:uninitialized\n", f->name,
> - resctrl_ctrl_is_default(ctrl) ? "" : "_",
> - resctrl_ctrl_is_default(ctrl) ?
> - "" : resctrl_ctrl_name_str(ctrl->name));
> + seq_printf(s, "%*s:uninitialized\n",
> + max_name_width, ctrl->schema_name);
> }
> } else if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) {
> if (!rdtgrp->plr->d) {
> rdt_last_cmd_puts("Cache domain offline\n");
> ret = -ENODEV;
> } else {
> - seq_printf(s, "%s:%d=%x\n",
> - rdtgrp->plr->f->res->name,
> + ctrl = resctrl_resource_ctrl_get_default(f->res);

I think f is only set in the for loops, so should this be
rdtgrp->plr->f->res instead of f->res?

Thanks,
Drew