perf lock contention: Skip stack trace from BPF

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: Namhyung Kim <namhyung@kernel.org>
2 files changed