Re: [PATCH v11 03/15] tracing: Split up onmatch action data

From: Namhyung Kim
Date: Thu Jan 10 2019 - 23:33:24 EST


Hi Tom,

On Wed, Jan 09, 2019 at 01:49:10PM -0600, Tom Zanussi wrote:
> From: Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx>
>
> Currently, the onmatch action data binds the onmatch action to data
> related to synthetic event generation. Since we want to allow the
> onmatch handler to potentially invoke a different action, and because
> we expect other handlers to generate synthetic events, we need to
> separate the data related to these two functions.
>
> Also rename the onmatch data to something more descriptive, and create
> and use common action data destroy function.
>
> Signed-off-by: Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx>
> ---
[SNIP]
>
> -static void onmax_destroy(struct action_data *data)
> +static void action_data_destroy(struct action_data *data)
> {
> unsigned int i;
>
> - destroy_hist_field(data->onmax.max_var, 0);
> - destroy_hist_field(data->onmax.var, 0);
> + lockdep_assert_held(&event_mutex);
>
> - kfree(data->onmax.var_str);
> kfree(data->action_name);
>
> for (i = 0; i < data->n_params; i++)
> kfree(data->params[i]);
>
> + if (data->synth_event)
> + data->synth_event->ref--;
> +

I was wondering about the missing synth_event_mutex used to guard the
refcount. Then I noticed that I totally missed Masami's dynamic event
work which removed it. Nice job..

Thanks,
Namhyung


> kfree(data);
> }
>
> +static void onmax_destroy(struct action_data *data)
> +{
> + destroy_hist_field(data->onmax.max_var, 0);
> + destroy_hist_field(data->onmax.var, 0);
> +
> + kfree(data->onmax.var_str);
> +
> + action_data_destroy(data);
> +}