From 34c35979c55ac79d8a5cce98f989f7832286b01a Mon Sep 17 00:00:00 2001 From: Alexandre425 Date: Tue, 7 Jul 2026 14:30:44 +0100 Subject: [PATCH] Fix 32-bit count wrap in chase counter The per-thread chase counter was (32-bit), which wraps at 2^32 iterations. At high throughputs (>69 GB/s in a 500 ms sample) the counter wraps once or more, making the fastest pointer-chase runs report inflated latency. Change the field to 'uint64_t', eliminating wrap on any realistic measurement window. multiload.c already had this fix (volatile uint64_t count). --- multichase.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multichase.c b/multichase.c index ff2e20f..30d4b76 100644 --- a/multichase.c +++ b/multichase.c @@ -78,7 +78,7 @@ typedef union { char pad[AVOID_FALSE_SHARING]; struct { unsigned thread_num; // which thread is this - unsigned count; // count of number of iterations + uint64_t count; // count of number of iterations void *cycle[MAX_PARALLEL]; // initial address for the chases const char *extra_args; int dummy; // useful for confusing the compiler @@ -493,7 +493,7 @@ static void *thread_start(void *data) { args->x.genchase_args->arena + args->x.genchase_args->total_memory); #endif } - + // now flush our caches if (args->x.cache_flush_size) { size_t nr_elts = args->x.cache_flush_size / sizeof(size_t);