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

From: Yu Chen
Date: Sun Nov 24 2019 - 22:28:53 EST


Hi Alexey,
thanks for looking at this patch.
On Sun, Nov 24, 2019 at 04:25:13PM +0300, Alexey Dobriyan wrote:
> On Fri, Nov 22, 2019 at 05:58:33PM +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}/resctrl to provide this
> > information.
>
> > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>
> > + seq_printf(s, "/%s", rdtg->kn->name);
> > + list_for_each_entry(crg, &rdtg->mon.crdtgrp_list,
> > + mon.crdtgrp_list) {
> > + if (tsk->rmid != crg->mon.rmid)
> > + continue;
> > + seq_printf(s, "%smon_groups/%s",
> > + rdtg == &rdtgroup_default ? "" : "/",
> > + crg->kn->name);
> > + break;
> > + }
> > + seq_puts(s, "\n");
>
> This should be seq_putc().
>
>
Okay, changed in next version.
> > --- /dev/null
> > +++ b/include/linux/resctrl.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef _RESCTRL_H
> > +#define _RESCTRL_H
> > +
> > +#ifdef CONFIG_PROC_CPU_RESCTRL
> > +
> > +#include <linux/proc_fs.h>
>
> Forward declaring stuff should be more than enough.
>
Okay, deleted in next version.
Then after removing this header, the .c files(besides proc/fs/base.c)
who include resctrl.h should be responsible to import corresondling
headers themselves.

Thanks,
Chenyu
> > +int proc_resctrl_show(struct seq_file *m,
> > + struct pid_namespace *ns,
> > + struct pid *pid,
> > + struct task_struct *tsk);
> > +
> > +#endif
> > +
> > +#endif /* _RESCTRL_H */