Re: [RFC PATCH 2/7] core/metricfs: add support for percpu metricfs files

Greg KH
2020-08-08T05:43:11Z

On Fri, Aug 07, 2020 at 02:29:11PM -0700, Jonathan Adams wrote:
> Add a simple mechanism for exporting percpu data through metricfs.
> The API follows the existing metricfs pattern. A percpu file is
> defined with:
>
> METRIC_EXPORT_PERCPU_INT(name, desc, fn)
> METRIC_EXPORT_PERCPU_COUNTER(name, desc, fn)
>
> The first defines a file for exposing a percpu int. The second is
> similar, but is for a counter that accumulates since boot. The
> 'name' is used as the metricfs file. The 'desc' is a description
> of the metric. The 'fn' is a callback function to emit a single
> percpu value:
>
> void (*fn)(struct metric_emitter *e, int cpu);
>
> The callback must call METRIC_EMIT_PERCPU_INT with the value for
> the specified CPU.
>
> Signed-off-by: Jonathan Adams <jwadams@google.com>
>
> ---
>
> jwadams@google.com: rebased to 5.6-pre6, renamed funcs to start with
> metric_. This is work originally done by another engineer at
> google, who would rather not have their name associated with this
> patchset. They're okay with me sending it under my name.
> ---
> include/linux/metricfs.h | 28 +++++++++++++++++++
> kernel/metricfs.c | 58 ++++++++++++++++++++++++++++++++++++----

fs/metricfs/ ? This isn't a kernel "core" feature.

Or just put it in fs/debugfs/ and tack it along with one of the debugfs
helper functions to make it easier for everyone to use these (if they
actually are valuable. It's hard to see how this differs from any other
debugfs interface today.

thanks,

greg k-h