lkml.org 
[lkml]   [2008]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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



\
 
 \ /
  Last update: 2008-07-19 14:13    [W:0.035 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site