• Steven Rostedt (Google)'s avatar
    function_graph: Use bitmask to loop on fgraph entry · a5b6d4da
    Steven Rostedt (Google) authored
    Instead of looping through all the elements of fgraph_array[] to see if
    there's an gops attached to one and then calling its gops->func(). Create
    a fgraph_array_bitmask that sets bits when an index in the array is
    reserved (via the simple lru algorithm). Then only the bits set in this
    bitmask needs to be looked at where only elements in the array that have
    ops registered need to be looked at.
    
    Note, we do not care about races. If a bit is set before the gops is
    assigned, it only wastes time looking at the element and ignoring it (as
    it did before this bitmask is added).
    
    Link: https://lore.kernel.org/linux-trace-kernel/20240603190824.604448781@goodmis.org
    
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
    Cc: Florent Revest <revest@chromium.org>
    Cc: Martin KaFai Lau <martin.lau@linux.dev>
    Cc: bpf <bpf@vger.kernel.org>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Alan Maguire <alan.maguire@oracle.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Guo Ren <guoren@kernel.org>
    Reviewed-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    a5b6d4da
fgraph.c 36 KB