On Fri,  9 Apr 2021 21:10:28 +0300
"Yordan Karadzhov (VMware)" <y.kar...@gmail.com> wrote:

> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -262,6 +262,17 @@ struct cond_snapshot {
>       cond_update_fn_t                update;
>  };
>  
> +/*
> + * struct trace_func_repeats - used to keep track of the consecutive
> + * (on the same CPU) calls of a single function.
> + */
> +struct trace_func_repeats {
> +     unsigned long   ip;
> +     unsigned long   parent_ip;
> +     unsigned long   count;
> +     u64             ts_last_call;
> +};
> +
>  /*
>   * The trace array - an array of per-CPU trace arrays. This is the
>   * highest level data structure that individual tracers deal with.
> @@ -358,8 +369,15 @@ struct trace_array {
>  #ifdef CONFIG_TRACER_SNAPSHOT
>       struct cond_snapshot    *cond_snapshot;
>  #endif
> +     struct trace_func_repeats       __percpu *last_func_repeats;
>  };
>  
> +static inline struct trace_func_repeats __percpu *
> +tracer_alloc_func_repeats(struct trace_array *tr)
> +{
> +     return tr->last_func_repeats = alloc_percpu(struct trace_func_repeats);
> +}

Also, is there a reason this is in the header file? It's only used in one C
file, and should be a static function there.

-- Steve


> +
>  enum {
>       TRACE_ARRAY_FL_GLOBAL   = (1 << 0)
>  };

Reply via email to