From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-perf-users@vger.kernel.org, Song Liu <song@kernel.org>,
Blake Jones <blakejones@google.com>,
bpf@vger.kernel.org
Subject: [PATCH 0/6] perf lock contention: Add more filter options (v1)
Date: Mon, 19 Dec 2022 12:17:26 -0800 [thread overview]
Message-ID: <20221219201732.460111-1-namhyung@kernel.org> (raw)
Hello,
This patchset adds a couple of filters to perf lock contention command.
The -Y/--type-filter is to filter by lock types like spinlock or mutex.
$ sudo ./perf lock con -ab -Y spinlock -E 3 -- ./perf bench sched messaging
# Running 'sched/messaging' benchmark:
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.167 [sec]
contended total wait max wait avg wait type caller
11 669.31 us 107.17 us 60.85 us spinlock remove_wait_queue+0x14
10 586.85 us 87.62 us 58.68 us spinlock prepare_to_wait+0x27
186 497.36 us 12.94 us 2.67 us spinlock try_to_wake_up+0x1f5
For the same workload, you can see the rwlock results only like below.
$ sudo ./perf lock con -ab -Y rwlock -E 3 -- ./perf bench sched messaging
# Running 'sched/messaging' benchmark:
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.171 [sec]
contended total wait max wait avg wait type caller
20 142.11 us 17.10 us 7.11 us rwlock:W do_exit+0x36d
3 26.49 us 12.04 us 8.83 us rwlock:W release_task+0x6e
5 12.46 us 5.12 us 2.49 us rwlock:R do_wait+0x8b
The -L/--lock-filter is to filter by lock address or name. You can use
the existing -l/--lock-addr option to get the info.
$ sudo ./perf lock con -abl -- ./perf bench sched messaging 2>&1 | grep tasklist_lock
25 39.78 us 16.51 us 1.59 us ffffffff9d006080 tasklist_lock
And use it with -L option like below.
$ sudo ./perf lock con -ab -L tasklist_lock -- ./perf bench sched messaging 2>&1
# Running 'sched/messaging' benchmark:
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.174 [sec]
contended total wait max wait avg wait type caller
22 227.18 us 24.16 us 10.33 us rwlock:W do_exit+0x36d
3 26.12 us 18.03 us 8.71 us rwlock:W release_task+0x6e
Passing the address is supported too.
$ sudo ./perf lock con -ab -L ffffffff9d006080 -- ./perf bench sched messaging 2>&1
# Running 'sched/messaging' benchmark:
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 0.190 [sec]
contended total wait max wait avg wait type caller
28 276.62 us 16.90 us 9.88 us rwlock:W do_exit+0x36d
4 22.36 us 7.04 us 5.59 us rwlock:R do_wait+0x8b
2 10.51 us 5.38 us 5.25 us rwlock:W release_task+0x6e
You can get it from 'perf/lock-filter-v1' branch in
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Thanks,
Namhyung
Namhyung Kim (6):
perf lock contention: Factor out lock_type_table
perf lock contention: Add -Y/--type-filter option
perf lock contention: Support lock type filtering for BPF
perf lock contention: Add -L/--lock-filter option
perf lock contention: Support lock addr/name filtering for BPF
perf test: Update perf lock contention test
tools/perf/Documentation/perf-lock.txt | 27 +-
tools/perf/builtin-lock.c | 305 ++++++++++++++++--
tools/perf/tests/shell/lock_contention.sh | 58 +++-
tools/perf/util/bpf_lock_contention.c | 55 +++-
.../perf/util/bpf_skel/lock_contention.bpf.c | 38 ++-
tools/perf/util/lock-contention.h | 10 +
6 files changed, 451 insertions(+), 42 deletions(-)
base-commit: 51c4f2bf5397b34b79a6712221606e0ab2e6f7ed
--
2.39.0.314.g84b9a713c41-goog
next reply other threads:[~2022-12-19 20:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 20:17 Namhyung Kim [this message]
2022-12-19 20:17 ` [PATCH 1/6] perf lock contention: Factor out lock_type_table Namhyung Kim
2022-12-19 20:17 ` [PATCH 2/6] perf lock contention: Add -Y/--type-filter option Namhyung Kim
2022-12-21 17:50 ` Arnaldo Carvalho de Melo
2022-12-21 17:54 ` Namhyung Kim
2022-12-19 20:17 ` [PATCH 3/6] perf lock contention: Support lock type filtering for BPF Namhyung Kim
2022-12-19 20:17 ` [PATCH 4/6] perf lock contention: Add -L/--lock-filter option Namhyung Kim
2022-12-19 20:17 ` [PATCH 5/6] perf lock contention: Support lock addr/name filtering for BPF Namhyung Kim
2022-12-19 20:17 ` [PATCH 6/6] perf test: Update perf lock contention test Namhyung Kim
2022-12-20 18:28 ` [PATCH 0/6] perf lock contention: Add more filter options (v1) Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221219201732.460111-1-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=blakejones@google.com \
--cc=bpf@vger.kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).