Você provavelmente deve procurar em ftrace , a ferramenta interna de rastreamento de kernel do Linux. Por exemplo, este artigo do LWN ligeiramente desatualizado diz
Ftrace introduces a new form of printk() called trace_printk(). It can be used just like printk(), and can also be used in any context (interrupt code, NMI code, and scheduler code). What is nice about trace_printk() is that it does not output to the console. Instead it writes to the Ftrace ring buffer and can be read via the trace file. Writing into the ring buffer with trace_printk() only takes around a tenth of a microsecond or so.
For example you can add something like this to the kernel or module:
trace_printk("read foo %d out of bar %p\n", bar->foo, bar);
O kernel doc ftrace.txt tem os detalhes . No diretório /sys/kernel/debug/tracing/
, você pode definir o tamanho do buffer do anel de rastreamento no pseudo arquivo buffer_size_kb
.