Re: [PATCH][v6] x86/resctrl: Add task resctrl information display

From: Borislav Petkov
Date: Tue Jan 14 2020 - 04:25:01 EST


On Fri, Jan 10, 2020 at 03:06:08PM +0800, Chen Yu wrote:
> Monitoring tools that want to find out which resctrl control
> and monitor groups a task belongs to must currently read
> the "tasks" file in every group until they locate the process
> ID.
>
> Add an additional file /proc/{pid}/cpu_resctrl to provide this
> information.
>
> The output is as followed, for example:
>
> 1) ""
> Resctrl is not available.
>
> 2) "/"
> Task is part of the root group, task is not associated to
> any monitor group.
>
> 3) "/mon_groups/mon0"
> Task is part of the root group and monitor group mon0.
>
> 4) "/group0"
> Task is part of resctrl control group group0, task is not
> associated to any monitor group.
>
> 5) "/group0/mon_groups/mon1"
> Task is part of resctrl control group group0 and monitor
> group mon1.

So this way to present the information is totally non-intuitive,
IMNSVHO. What's wrong with:

1)
res_group:
mon_group:

2)
res_group: /
mon_group:

3)
res_group: /
mon_group: mon0

4)
res_group: group0
mon_group:

5)
res_group: group0
mon_group: mon1

?

You can even call the file "cpu_resctrl_groups" so that it is clear that
it will dump groups and then do:

res: group0
mon: mon1

which is both human-readable and easily greppable.

> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 2e3b06d6bbc6..dcbf62d6b689 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -725,6 +725,85 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of,
> return ret;
> }
>
> +#ifdef CONFIG_PROC_CPU_RESCTRL
> +
> +/*
> + * A task can only be part of one resctrl
> + * control group and of one monitor
> + * group which is associated to that resctrl
> + * control group.

Extend those comments to 80 cols.

> + * So one line is simple and clear enough:

Actually, the one line format you've done is confusing and can be done
much more human- and tool-readable.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette