• Namhyung Kim's avatar
    perf lock: Use BPF for lock contention analysis · 407b36f6
    Namhyung Kim authored
    Add -b/--use-bpf option to use BPF to collect lock contention stats.
    For simplicity it now runs system-wide and requires C-c to stop.
    Upcoming changes will add the usual filtering.
    
      $ sudo perf lock con -b
      ^C
       contended   total wait     max wait     avg wait         type   caller
    
              42    192.67 us     13.64 us      4.59 us     spinlock   queue_work_on+0x20
              23     85.54 us     10.28 us      3.72 us     spinlock   worker_thread+0x14a
               6     13.92 us      6.51 us      2.32 us        mutex   kernfs_iop_permission+0x30
               3     11.59 us     10.04 us      3.86 us        mutex   kernfs_dop_revalidate+0x3c
               1      7.52 us      7.52 us      7.52 us     spinlock   kthread+0x115
               1      7.24 us      7.24 us      7.24 us     rwlock:W   sys_epoll_wait+0x148
               2      7.08 us      3.99 us      3.54 us     spinlock   delayed_work_timer_fn+0x1b
               1      6.41 us      6.41 us      6.41 us     spinlock   idle_balance+0xa06
               2      2.50 us      1.83 us      1.25 us        mutex   kernfs_iop_lookup+0x2f
               1      1.71 us      1.71 us      1.71 us        mutex   kernfs_iop_getattr+0x2c
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Blake Jones <blakejones@google.com>
    Cc: Boqun Feng <boqun.feng@gmail.com>
    Cc: Davidlohr Bueso <dave@stgolabs.net>
    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: Stephane Eranian <eranian@google.com>
    Cc: Waiman Long <longman@redhat.com>
    Cc: Will Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20220729200756.666106-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    407b36f6
builtin-lock.c 42.3 KB