From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/5] tracing/ftrace: Types and naming corrections for sched tracer
Date: Wed, 22 Oct 2008 19:35:54 +0200 [thread overview]
Message-ID: <c62985530810221035y6c19f364k3e07512bdf17b59a@mail.gmail.com> (raw)
In-Reply-To: <48FF636F.6090804@gmail.com>
2008/10/22 Frederic Weisbecker <fweisbec@gmail.com>:
> This patch applies some corrections suggested by Steven Rostedt.
>
> Change the type of shed_ref into int since it is used
> into a Mutex, we don't need it anymore as an atomic
> variable in the sched_switch tracer.
> Also change the name of the register mutex.
>
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> ---
> kernel/trace/trace_sched_switch.c | 30 +++++++++++++-----------------
> 1 files changed, 13 insertions(+), 17 deletions(-)
>
> diff --git a/kernel/trace/trace_sched_switch.c
> b/kernel/trace/trace_sched_switch.c
> index 9d7bdac..969953b 100644
> --- a/kernel/trace/trace_sched_switch.c
> +++ b/kernel/trace/trace_sched_switch.c
> @@ -16,8 +16,8 @@
>
> static struct trace_array *ctx_trace;
> static int __read_mostly tracer_enabled;
> -static atomic_t sched_ref;
> -static DEFINE_MUTEX(tracepoint_mutex);
> +static int sched_ref;
> +static DEFINE_MUTEX(sched_register_mutex);
>
> static void
> probe_sched_switch(struct rq *__rq, struct task_struct *prev,
> @@ -28,7 +28,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
> int cpu;
> int pc;
>
> - if (!atomic_read(&sched_ref))
> + if (!sched_ref)
> return;
>
> tracing_record_cmdline(prev);
> @@ -124,26 +124,22 @@ static void tracing_sched_unregister(void)
>
> static void tracing_start_sched_switch(void)
> {
> - long ref;
> -
> - mutex_lock(&tracepoint_mutex);
> - tracer_enabled = 1;
> - ref = atomic_inc_return(&sched_ref);
> - if (ref == 1)
> + mutex_lock(&sched_register_mutex);
> + if (!(sched_ref++)) {
> + tracer_enabled = 1;
> tracing_sched_register();
> - mutex_unlock(&tracepoint_mutex);
> + }
> + mutex_unlock(&sched_register_mutex);
> }
>
> static void tracing_stop_sched_switch(void)
> {
> - long ref;
> -
> - mutex_lock(&tracepoint_mutex);
> - tracer_enabled = 0;
> - ref = atomic_dec_and_test(&sched_ref);
> - if (ref)
> + mutex_lock(&sched_register_mutex);
> + if (!(--sched_ref)) {
> tracing_sched_unregister();
> - mutex_unlock(&tracepoint_mutex);
> + tracer_enabled = 0;
> + }
> + mutex_unlock(&sched_register_mutex);
> }
>
> void tracing_start_cmdline_record(void)
>
Correction, it's not anymore a 1/5, it's just a resend.
next prev parent reply other threads:[~2008-10-22 17:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-22 17:31 Frederic Weisbecker
2008-10-22 17:35 ` Frédéric Weisbecker [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-10-11 20:11 Frederic Weisbecker
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=c62985530810221035y6c19f364k3e07512bdf17b59a@mail.gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/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
all inboxes | Powered by JetHome®