Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2013  Davidlohr Bueso <davidlohr@hp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * futex-hash: Stress the hell out of the Linux kernel futex uaddr hashing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * This program is particularly useful for measuring the kernel's futex hash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * table/function implementation. In order for it to make sense, use with as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * many threads and futexes as possible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) /* For the CLR_() macros */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <pthread.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <signal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/zalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <sys/time.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <internal/cpumap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <perf/cpumap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include "../util/stat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <subcmd/parse-options.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "bench.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include "futex.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static unsigned int nthreads = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) static unsigned int nsecs    = 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) /* amount of futexes per thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) static unsigned int nfutexes = 1024;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static bool fshared = false, done = false, silent = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static int futex_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) struct timeval bench__start, bench__end, bench__runtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static pthread_mutex_t thread_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static unsigned int threads_starting;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static struct stats throughput_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) static pthread_cond_t thread_parent, thread_worker;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) struct worker {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	int tid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u_int32_t *futex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	pthread_t thread;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	unsigned long ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) static const struct option options[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	OPT_UINTEGER('t', "threads", &nthreads, "Specify amount of threads"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	OPT_UINTEGER('r', "runtime", &nsecs,    "Specify runtime (in seconds)"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	OPT_UINTEGER('f', "futexes", &nfutexes, "Specify amount of futexes per threads"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	OPT_BOOLEAN( 's', "silent",  &silent,   "Silent mode: do not display data/details"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	OPT_BOOLEAN( 'S', "shared",  &fshared,  "Use shared futexes instead of private ones"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	OPT_END()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static const char * const bench_futex_hash_usage[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	"perf bench futex hash <options>",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static void *workerfn(void *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	struct worker *w = (struct worker *) arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	unsigned long ops = w->ops; /* avoid cacheline bouncing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	pthread_mutex_lock(&thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	threads_starting--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	if (!threads_starting)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		pthread_cond_signal(&thread_parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	pthread_cond_wait(&thread_worker, &thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	pthread_mutex_unlock(&thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	do {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		for (i = 0; i < nfutexes; i++, ops++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			 * We want the futex calls to fail in order to stress
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			 * the hashing of uaddr and not measure other steps,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			 * such as internal waitqueue handling, thus enlarging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 			 * the critical region protected by hb->lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			ret = futex_wait(&w->futex[i], 1234, NULL, futex_flag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 			if (!silent &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 			    (!ret || errno != EAGAIN || errno != EWOULDBLOCK))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 				warn("Non-expected futex return call");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	}  while (!done);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	w->ops = ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) static void toggle_done(int sig __maybe_unused,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			siginfo_t *info __maybe_unused,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 			void *uc __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	/* inform all threads that we're done for the day */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	done = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	gettimeofday(&bench__end, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	timersub(&bench__end, &bench__start, &bench__runtime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static void print_summary(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	unsigned long avg = avg_stats(&throughput_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	double stddev = stddev_stats(&throughput_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	       !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	       (int)bench__runtime.tv_sec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) int bench_futex_hash(int argc, const char **argv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	cpu_set_t cpuset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	struct sigaction act;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	pthread_attr_t thread_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	struct worker *worker = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	struct perf_cpu_map *cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	argc = parse_options(argc, argv, options, bench_futex_hash_usage, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	if (argc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		usage_with_options(bench_futex_hash_usage, options);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		exit(EXIT_FAILURE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	cpu = perf_cpu_map__new(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	if (!cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		goto errmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	memset(&act, 0, sizeof(act));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	sigfillset(&act.sa_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	act.sa_sigaction = toggle_done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	sigaction(SIGINT, &act, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	if (!nthreads) /* default to the number of CPUs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		nthreads = cpu->nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	worker = calloc(nthreads, sizeof(*worker));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	if (!worker)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		goto errmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	if (!fshared)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		futex_flag = FUTEX_PRIVATE_FLAG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	printf("Run summary [PID %d]: %d threads, each operating on %d [%s] futexes for %d secs.\n\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	       getpid(), nthreads, nfutexes, fshared ? "shared":"private", nsecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	init_stats(&throughput_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	pthread_mutex_init(&thread_lock, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	pthread_cond_init(&thread_parent, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	pthread_cond_init(&thread_worker, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	threads_starting = nthreads;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	pthread_attr_init(&thread_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	gettimeofday(&bench__start, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	for (i = 0; i < nthreads; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		worker[i].tid = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		worker[i].futex = calloc(nfutexes, sizeof(*worker[i].futex));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		if (!worker[i].futex)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			goto errmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		CPU_ZERO(&cpuset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		CPU_SET(cpu->map[i % cpu->nr], &cpuset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cpu_set_t), &cpuset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			err(EXIT_FAILURE, "pthread_attr_setaffinity_np");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		ret = pthread_create(&worker[i].thread, &thread_attr, workerfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				     (void *)(struct worker *) &worker[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			err(EXIT_FAILURE, "pthread_create");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	pthread_attr_destroy(&thread_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	pthread_mutex_lock(&thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	while (threads_starting)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		pthread_cond_wait(&thread_parent, &thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	pthread_cond_broadcast(&thread_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	pthread_mutex_unlock(&thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	sleep(nsecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	toggle_done(0, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	for (i = 0; i < nthreads; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		ret = pthread_join(worker[i].thread, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 			err(EXIT_FAILURE, "pthread_join");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	/* cleanup & report results */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	pthread_cond_destroy(&thread_parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	pthread_cond_destroy(&thread_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	pthread_mutex_destroy(&thread_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	for (i = 0; i < nthreads; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		unsigned long t = bench__runtime.tv_sec > 0 ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			worker[i].ops / bench__runtime.tv_sec : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		update_stats(&throughput_stats, t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		if (!silent) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 			if (nfutexes == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 				printf("[thread %2d] futex: %p [ %ld ops/sec ]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 				       worker[i].tid, &worker[i].futex[0], t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 				printf("[thread %2d] futexes: %p ... %p [ %ld ops/sec ]\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 				       worker[i].tid, &worker[i].futex[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 				       &worker[i].futex[nfutexes-1], t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		zfree(&worker[i].futex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	print_summary();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	free(worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	free(cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) errmem:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	err(EXIT_FAILURE, "calloc");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }