From: Michal Pluta <michalpl2003@gmail.com>
To: acme@kernel.org, namhyung@kernel.org
Cc: "Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Darren Hart" <dvhart@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"André Almeida" <andrealmeid@igalia.com>,
"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>,
"James Clark" <james.clark@linaro.org>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH 6/8] perf bench futex: Use a 64-bit operation counter in hash and lock-pi
Date: Sat, 26 Sep 2026 20:04:05 +0100 [thread overview]
Message-ID: <20260926190407.1106421-7-michalpl2003@gmail.com> (raw)
In-Reply-To: <20260926190407.1106421-1-michalpl2003@gmail.com>
The per-thread operation counters in 'futex hash' and 'futex lock-pi'
are unsigned longs, which could overflow on 32-bit systems. Use u64
instead.
Assisted-by: LLM
Signed-off-by: Michal Pluta <michalpl2003@gmail.com>
---
tools/perf/bench/futex-hash.c | 6 +++---
tools/perf/bench/futex-lock-pi.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
index 710c253cfe17..e18d98664d27 100644
--- a/tools/perf/bench/futex-hash.c
+++ b/tools/perf/bench/futex-hash.c
@@ -46,7 +46,7 @@ struct worker {
int tid;
u_int32_t *futex;
pthread_t thread;
- unsigned long ops;
+ u64 ops;
};
static struct bench_futex_parameters params = {
@@ -76,7 +76,7 @@ static void *workerfn(void *arg)
int ret;
struct worker *w = (struct worker *) arg;
unsigned int i;
- unsigned long ops = w->ops; /* avoid cacheline bouncing */
+ u64 ops = w->ops; /* avoid cacheline bouncing */
mutex_lock(&thread_lock);
threads_starting--;
@@ -238,7 +238,7 @@ int bench_futex_hash(int argc, const char **argv)
for (i = 0; i < params.nthreads; i++) {
unsigned long t = runtime_us ?
- (u64)worker[i].ops * USEC_PER_SEC / runtime_us : 0;
+ worker[i].ops * USEC_PER_SEC / runtime_us : 0;
update_stats(&throughput_stats, t);
if (!params.silent) {
if (params.nfutexes == 1)
diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
index 7190f5102e09..8016a31b198d 100644
--- a/tools/perf/bench/futex-lock-pi.c
+++ b/tools/perf/bench/futex-lock-pi.c
@@ -29,7 +29,7 @@ struct worker {
int tid;
u_int32_t *futex;
pthread_t thread;
- unsigned long ops;
+ u64 ops;
};
static u_int32_t global_futex = 0;
@@ -86,7 +86,7 @@ static void toggle_done(int sig __maybe_unused,
static void *workerfn(void *arg)
{
struct worker *w = (struct worker *) arg;
- unsigned long ops = w->ops;
+ u64 ops = w->ops;
mutex_lock(&thread_lock);
threads_starting--;
@@ -239,7 +239,7 @@ int bench_futex_lock_pi(int argc, const char **argv)
for (i = 0; i < params.nthreads; i++) {
unsigned long t = runtime_us ?
- (u64)worker[i].ops * USEC_PER_SEC / runtime_us : 0;
+ worker[i].ops * USEC_PER_SEC / runtime_us : 0;
update_stats(&throughput_stats, t);
if (!params.silent)
--
2.43.0
next prev parent reply other threads:[~2026-09-26 19:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 19:03 [PATCH 0/8] perf bench futex: Fix several bugs and bad inputs Michal Pluta
2026-09-26 19:04 ` [PATCH 1/8] perf bench futex: Retry futex_wait() when interrupted by a signal Michal Pluta
2026-09-26 19:13 ` sashiko-bot
2026-10-05 23:49 ` Namhyung Kim
2026-09-26 19:04 ` [PATCH 2/8] perf bench futex: Set the number of hash buckets in futex wake Michal Pluta
2026-09-26 19:09 ` sashiko-bot
2026-09-26 19:04 ` [PATCH 3/8] perf bench futex: Use the whole timeval for elapsed times Michal Pluta
2026-09-26 19:11 ` sashiko-bot
2026-10-05 23:54 ` Namhyung Kim
2026-09-26 19:04 ` [PATCH 4/8] perf bench futex: Reject invalid -q, -f and -b values Michal Pluta
2026-09-26 19:10 ` sashiko-bot
2026-09-26 19:04 ` [PATCH 5/8] perf bench futex: Stop when futex_wake() fails in futex wake Michal Pluta
2026-09-26 19:10 ` sashiko-bot
2026-09-26 19:04 ` Michal Pluta [this message]
2026-09-26 19:10 ` [PATCH 6/8] perf bench futex: Use a 64-bit operation counter in hash and lock-pi sashiko-bot
2026-09-26 19:04 ` [PATCH 7/8] perf bench futex: Clean up two nits in futex hash Michal Pluta
2026-09-26 19:10 ` sashiko-bot
2026-09-26 19:04 ` [PATCH 8/8] perf bench futex: Fix wording in futex bench messages Michal Pluta
2026-09-26 19:13 ` sashiko-bot
2026-10-05 23:57 ` Namhyung Kim
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=20260926190407.1106421-7-michalpl2003@gmail.com \
--to=michalpl2003@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrealmeid@igalia.com \
--cc=bigeasy@linutronix.de \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.