[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.58.0807190801530.11122@gandalf.stny.rr.com>
Date: Sat, 19 Jul 2008 08:11:26 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Theodore Ts'o <tytso@....EDU>
cc: Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org
Subject: Re: Ftraced always polls once a minute even when no tracer is active
On Fri, 18 Jul 2008, Theodore Ts'o wrote:
>
> I noticed with powertop that ftraced waks up once a second, even if no
> tracer is active. Is there a reason why the kernel thread can't be
> suspended in that case?
That's for the dynamic tracer. It is actually stopped when a tracer is
active ;-)
CONFIG_FTRACE enables the "-pg" option in the kernel compile that enables
the mcount profiler. This adds a call to a function called "mcount" at the
start of every function. With a simple "ret" from mcount, this still adds
up to a 18% overhead.
What the dynamic ftrace does is to have the mcount function call a
"register_ip" function, that adds the caller into a hash table if it is
not already there.
Once a second the "ftraced" kernel thread wakes up and checks to see if
there are any new functions that have been called and recorded. If there
has been, it calls kstop_machine and changes the call to mcount into a
nop. This keeps the system to a 0% overhead (well, probably not 0% but it
is not measurable ;-).
I should add code to stop the kthread when the system is low. I notice
that the thread still wakes up but goes to sleep even when ftraced_enabled
is zero.
I'm currently traveling and I'm trying to finish up the ftrace tutorial
for OLS. I'll have to look more into this when I get back.
Thanks,
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists