• Namhyung Kim's avatar
    perf lock contention: Skip stack trace from BPF · c1da8dd5
    Namhyung Kim authored
    Currently it collects stack traces to max size then skip entries.
    Because we don't have control how to skip perf callchains.  But BPF can
    do it with bpf_get_stackid() with a flag.
    
    Say we have max-stack=4 and stack-skip=2, we get these stack traces.
    
    Before:                    After:
    
         .---> +---+ <--.           .---> +---+ <--.
         |     |   |    |           |     |   |    |
         |     +---+  usable        |     +---+    |
        max    |   |    |          max    |   |    |
       stack   +---+ <--'         stack   +---+  usable
         |     | X |                |     |   |    |
         |     +---+   skip         |     +---+    |
         |     | X |                |     |   |    |
         `---> +---+                `---> +---+ <--'   <=== collection
                                          | X |
                                          +---+   skip
                                          | X |
                                          +---+
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: bpf@vger.kernel.org
    Link: https://lore.kernel.org/r/20220912055314.744552-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    c1da8dd5
bpf_lock_contention.c 4.32 KB