linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Slavomir Kaslev <kaslevs@vmware.com>
To: Yordan Karadzhov <ykaradzhov@vmware.com>
Cc: rostedt@goodmis.org, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/3] kernel-shark: Define free_contex function for the sched_events plugin
Date: Tue, 5 Mar 2019 17:54:26 +0200	[thread overview]
Message-ID: <20190305155425.GA19674@box> (raw)
In-Reply-To: <20190305143924.11056-2-ykaradzhov@vmware.com>

On Tue, Mar 05, 2019 at 04:39:22PM +0200, Yordan Karadzhov wrote:
> This static helper function makes the code of the plugin cleaner and
> easier to read.
> 
> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
> ---
>  kernel-shark/src/plugins/sched_events.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel-shark/src/plugins/sched_events.c b/kernel-shark/src/plugins/sched_events.c
> index 68734d4..0d6de2d 100644
> --- a/kernel-shark/src/plugins/sched_events.c
> +++ b/kernel-shark/src/plugins/sched_events.c
> @@ -39,6 +39,17 @@ static bool define_wakeup_event(struct tep_handle *tep, const char *wakeup_name,
>  	return true;
>  }
>  
> +static void plugin_free_context(struct plugin_sched_context *plugin_ctx)
> +{
> +	if (!plugin_ctx)
> +		return;
> +
> +	tracecmd_filter_id_hash_free(plugin_ctx->second_pass_hash);
> +	kshark_free_collection_list(plugin_ctx->collections);
> +
> +	free(plugin_ctx);
> +}
> +
>  static bool plugin_sched_init_context(struct kshark_context *kshark_ctx)
>  {
>  	struct plugin_sched_context *plugin_ctx;
> @@ -339,10 +350,7 @@ static int plugin_sched_close(struct kshark_context *kshark_ctx)
>  					plugin_sched_action,
>  					plugin_draw);
>  
> -	tracecmd_filter_id_hash_free(plugin_ctx->second_pass_hash);
> -
> -	kshark_free_collection_list(plugin_ctx->collections);
> -	free(plugin_ctx);
> +	plugin_free_context(plugin_ctx);
>  	plugin_sched_context_handler = NULL;
>  
>  	return 1;

Nit: there's a typo in the commit message

>    kernel-shark: Define free_contex function for the sched_events plugin
                                     ^
:s/free_contex/plugin_free_context/g ?

Other than that it looks good to me.

Reviewed-by: Slavomir Kaslev <kaslevs@vmware.com>

Cheers,

-- Slavi

  reply	other threads:[~2019-03-05 15:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 14:39 [PATCH 0/3] Improvements and fixes for sched_switch plugin Yordan Karadzhov
2019-03-05 14:39 ` [PATCH 1/3] kernel-shark: Define free_contex function for the sched_events plugin Yordan Karadzhov
2019-03-05 15:54   ` Slavomir Kaslev [this message]
2019-03-05 17:11     ` Steven Rostedt
2019-03-05 14:39 ` [PATCH 2/3] kernel-shark: Fix a memory leak in " Yordan Karadzhov
2019-03-05 15:56   ` Slavomir Kaslev
2019-03-05 17:12     ` Steven Rostedt
2019-03-05 17:07   ` Steven Rostedt
2019-03-05 14:39 ` [PATCH 3/3] kernel-shark: sched_events plugin init with sched_switch events only Yordan Karadzhov
2019-03-05 15:57   ` Slavomir Kaslev
2019-03-05 17:13     ` Steven Rostedt
2019-03-05 17:09   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190305155425.GA19674@box \
    --to=kaslevs@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=ykaradzhov@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).