On Wed, Aug 31, 2022 at 11:59:41AM -0400, Kent Overstreet wrote: > Also, ftrace can drop events. Not really ideal if under system load your > memory > accounting numbers start to drift.
You could attach custom handlers to tracepoints. If you were to replace these unconditional code hooks of yours with tracepoints then you could conditionally (say at boot) register custom handlers that do the accounting you want. Nobody is mandating you use the ftrace ringbuffer to consume tracepoints. Many people these days attach eBPF scripts to them and do whatever they want.