From: Yuzhuo Jing <yuzhuo@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Liang Kan <kan.liang@linux.intel.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>, Yuzhuo Jing <yzj@umich.edu>,
Yuzhuo Jing <yuzhuo@google.com>, Guo Ren <guoren@kernel.org>,
Andrea Parri <parri.andrea@gmail.com>,
Leonardo Bras <leobras@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: [PATCH v1 0/3] perf bench: Add ticket spinlock benchmark
Date: Tue, 29 Jul 2025 01:12:53 -0700 [thread overview]
Message-ID: <20250729081256.3433892-1-yuzhuo@google.com> (raw)
This patch series adds benchmark for the kernel's ticket spinlock
implementation.
This series depends on a preceding patch series that introduces the
'perf bench sync' benchmark infrastructure.
Link: https://lore.kernel.org/lkml/20250729022640.3134066-1-yuzhuo@google.com/
In a quick test, on a 48C 96T x86 VM, ticket spinlock performs better on
2-6 threads, and qspinlock performs better on 1 thread or >=8 threads.
$ # set 't' variable, and then
$ ./perf bench sync qspinlock -t$t; sleep 1; ./perf bench sync ticket -t$t
'sync/qspinlock' benchmarks:
Lock-unlock latency of 1 threads: 8.5779 ns.
Lock-unlock latency of 2 threads: 187.1022 ns.
...
Lock-unlock latency of 6 threads: 1202.8312 ns.
...
Lock-unlock latency of 8 threads: 1541.566 ns.
Lock-unlock latency of 96 threads: 44140.8765 ns.
'sync/ticket' benchmarks:
Lock-unlock latency of 1 threads: 12.1888 ns.
Lock-unlock latency of 2 threads: 168.1132 ns.
...
Lock-unlock latency of 6 threads: 1033.2760 ns.
....
Lock-unlock latency of 8 threads: 1667.1647 ns.
Lock-unlock latency of 96 threads: 66915.8949 ns.
Yuzhuo Jing (3):
tools: Import atomic_fetch_{and,add,sub}
perf bench: Import ticket_spinlock from kerne
perf bench: Add 'bench sync ticket' subcommand
tools/arch/x86/include/asm/atomic.h | 17 ++++
tools/arch/x86/include/asm/cmpxchg.h | 11 +++
tools/include/asm-generic/atomic-gcc.h | 51 ++++++++++
tools/perf/bench/bench.h | 1 +
tools/perf/bench/include/ticket_spinlock.h | 107 +++++++++++++++++++++
tools/perf/bench/sync.c | 17 ++++
tools/perf/builtin-bench.c | 1 +
tools/perf/check-headers.sh | 3 +
8 files changed, 208 insertions(+)
create mode 100644 tools/perf/bench/include/ticket_spinlock.h
--
2.50.1.487.gc89ff58d15-goog
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2025-07-29 8:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 8:12 Yuzhuo Jing [this message]
2025-07-29 8:12 ` [PATCH v1 1/3] tools: Import atomic_fetch_{and,add,sub} Yuzhuo Jing
2025-07-29 8:12 ` [PATCH v1 2/3] perf bench: Import ticket_spinlock from kerne Yuzhuo Jing
2025-07-29 8:12 ` [PATCH v1 3/3] perf bench: Add 'bench sync ticket' subcommand Yuzhuo Jing
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=20250729081256.3433892-1-yuzhuo@google.com \
--to=yuzhuo@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alex@ghiti.fr \
--cc=alexander.shishkin@linux.intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=guoren@kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leobras@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=parri.andrea@gmail.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=yzj@umich.edu \
/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