From: Frederic Weisbecker <fweisbec@gmail.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Tom Zanussi <tzanussi@gmail.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing/filters: Defer pred allocation
Date: Mon, 31 Aug 2009 19:41:08 +0200 [thread overview]
Message-ID: <20090831174107.GB6048@nowhere> (raw)
In-Reply-To: <4A9B8EA5.6020700@cn.fujitsu.com>
On Mon, Aug 31, 2009 at 04:49:41PM +0800, Li Zefan wrote:
> @@ -1094,6 +1118,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
>
> mutex_lock(&event_mutex);
>
> + err = init_preds(call);
> + if (err)
> + goto out_unlock;
Hmm, but what happens if the filter already has its preds initialized
by a previous filter?
The first thing that init_preds() does is:
filter = call->filter = kzalloc(sizeof(*filter), GFP_KERNEL);
That looks like a memory leak.
> if (!strcmp(strstrip(filter_string), "0")) {
> filter_disable_preds(call);
> remove_filter_string(call->filter);
> @@ -1139,6 +1167,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
>
> mutex_lock(&event_mutex);
>
> + err = init_subsystem_preds(system);
Whereas this one has a check:
if (!call->filter)
alloc...
> + if (err)
> + goto out_unlock;
> +
> if (!strcmp(strstrip(filter_string), "0")) {
> filter_free_subsystem_preds(system, FILTER_DISABLE_ALL);
> remove_filter_string(system->filter);
> diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
> index 029a91f..df1bf6e 100644
> --- a/kernel/trace/trace_export.c
> +++ b/kernel/trace/trace_export.c
> @@ -135,7 +135,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
> static int ftrace_raw_init_event_##call(void) \
> { \
> INIT_LIST_HEAD(&event_##call.fields); \
> - init_preds(&event_##call); \
> return 0; \
> } \
>
> --
> 1.6.3
>
Other than the above doubts, that looks good.
next prev parent reply other threads:[~2009-08-31 17:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-31 8:49 [PATCH] tracing/filters: Defer pred allocation Li Zefan
2009-08-31 8:59 ` Ingo Molnar
2009-08-31 9:06 ` Li Zefan
2009-09-01 12:58 ` Masami Hiramatsu
2009-08-31 9:00 ` [tip:tracing/core] " tip-bot for Li Zefan
2009-08-31 17:41 ` Frederic Weisbecker [this message]
2009-09-01 0:50 ` [PATCH] " Li Zefan
2009-09-01 5:31 ` [PATCH] tracing/filters: Defer pred allocation, fix memory leak Li Zefan
2009-09-01 9:32 ` Frederic Weisbecker
2009-09-06 4:36 ` [tip:tracing/core] " tip-bot for Li Zefan
2009-09-01 3:28 ` [PATCH] tracing/filters: Defer pred allocation Tom Zanussi
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=20090831174107.GB6048@nowhere \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.