enable/disable ftrace tracepoints dynamically

modulename: mcount-dyn.ko

and/or

ftrace.ko

configname: CONFIG_DYNAMIC_FTRACE

Linux Kernel Configuration
└─>Tracers
└─>enable/disable ftrace tracepoints dynamically
In linux kernel since version 2.6.27 (release Date: 2008-10-09)  
This option will modify all the calls to ftrace dynamically
(will patch them out of the binary image and replaces them
with a No-Op instruction) as they are called. A table is
created to dynamically enable them again.

This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but otherwise
has native performance as long as no tracing is active.

The changes to the code are done by a kernel thread that
wakes up once a second and checks to see if any ftrace calls
were made. If so, it runs stop_machine (stops all CPUS)
and modifies the code to jump over the call to ftrace.

source code: