Re: [PATCH v2 5/5] fs/resctrl: Drop unnecessary parameter from resctrl_io_alloc_parse_line()
From: Jinjie Ruan
Date: Tue Oct 27 2026 - 04:42:00 EST
在 2026/10/8 5:06, Reinette Chatre 写道:
> resctrl_io_alloc_parse_line() parses a line written to the io_alloc_cbm file.
> It receives both a schema and a pointer to the schema's resource. Its only
> caller looks up the resource from the schema just to pass both.
>
> Passing the resource separately is redundant and allows a caller to pass a
> resource that does not belong to the schema. parse_line(), which parses lines
> written to the schemata file, already receives only the schema and determines
> the resource from it.
>
> Pass only the schema to resctrl_io_alloc_parse_line() and have it determine
> the resource itself, matching parse_line() and in preparation for passing
> additional information when supporting multiple controls.
>
> No functional change.
>
> Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> Reviewed-by: Ben Horgan <ben.horgan@xxxxxxx>
> ---
> Changes since RFC v2:
> - Rework changelog.
>
> Changes since v1:
> - Rework changelog.
> - Add justification for the change. (Ben)
> - Add Ben's Reviewed-by tag.
> ---
> fs/resctrl/ctrlmondata.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
> index 4562072b8ba6..69123b2a3274 100644
> --- a/fs/resctrl/ctrlmondata.c
> +++ b/fs/resctrl/ctrlmondata.c
> @@ -955,11 +955,12 @@ int resctrl_io_alloc_cbm_show(struct kernfs_open_file *of, struct seq_file *seq,
> return ret;
> }
>
> -static int resctrl_io_alloc_parse_line(char *line, struct rdt_resource *r,
> - struct resctrl_schema *s, u32 closid)
> +static int resctrl_io_alloc_parse_line(char *line, struct resctrl_schema *s,
> + u32 closid)
> {
> enum resctrl_conf_type peer_type;
> unsigned long dom_id = ULONG_MAX;
> + struct rdt_resource *r = s->res;
> struct rdt_parse_data data;
> struct rdt_ctrl_domain *d;
> bool update_all = false;
> @@ -1052,7 +1053,7 @@ ssize_t resctrl_io_alloc_cbm_write(struct kernfs_open_file *of, char *buf,
> io_alloc_closid = resctrl_io_alloc_closid(r);
>
> rdt_staged_configs_clear();
> - ret = resctrl_io_alloc_parse_line(buf, r, s, io_alloc_closid);
> + ret = resctrl_io_alloc_parse_line(buf, s, io_alloc_closid);
LGTM
Reviewed-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
> if (ret)
> goto out_clear_configs;
>
--
Best regards,
Jinjie