Remove glibc < 2.4 compat code for sched_setaffinity
[urcu.git] / tests / benchmark / test_urcu_hash.c
1 /*
2 * test_urcu_hash.c
3 *
4 * Userspace RCU library - test program
5 *
6 * Copyright 2009-2012 - Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 #include "test_urcu_hash.h"
24
25 enum test_hash {
26 TEST_HASH_RW,
27 TEST_HASH_UNIQUE,
28 };
29
30 struct test_hash_cb {
31 void (*sigusr1)(int signo);
32 void (*sigusr2)(int signo);
33 void *(*thr_reader)(void *_count);
34 void *(*thr_writer)(void *_count);
35 int (*populate_hash)(void);
36 };
37
38 static
39 struct test_hash_cb test_hash_cb[] = {
40 [TEST_HASH_RW] = {
41 test_hash_rw_sigusr1_handler,
42 test_hash_rw_sigusr2_handler,
43 test_hash_rw_thr_reader,
44 test_hash_rw_thr_writer,
45 test_hash_rw_populate_hash,
46 },
47 [TEST_HASH_UNIQUE] = {
48 test_hash_unique_sigusr1_handler,
49 test_hash_unique_sigusr2_handler,
50 test_hash_unique_thr_reader,
51 test_hash_unique_thr_writer,
52 test_hash_unique_populate_hash,
53 },
54
55 };
56
57 static enum test_hash test_choice = TEST_HASH_RW;
58
59 void (*get_sigusr1_cb(void))(int)
60 {
61 return test_hash_cb[test_choice].sigusr1;
62 }
63
64 void (*get_sigusr2_cb(void))(int)
65 {
66 return test_hash_cb[test_choice].sigusr2;
67 }
68
69 void *(*get_thr_reader_cb(void))(void *)
70 {
71 return test_hash_cb[test_choice].thr_reader;
72 }
73
74 void *(*get_thr_writer_cb(void))(void *)
75 {
76 return test_hash_cb[test_choice].thr_writer;
77 }
78
79 int (*get_populate_hash_cb(void))(void)
80 {
81 return test_hash_cb[test_choice].populate_hash;
82 }
83
84 DEFINE_URCU_TLS(unsigned int, rand_lookup);
85 DEFINE_URCU_TLS(unsigned long, nr_add);
86 DEFINE_URCU_TLS(unsigned long, nr_addexist);
87 DEFINE_URCU_TLS(unsigned long, nr_del);
88 DEFINE_URCU_TLS(unsigned long, nr_delnoent);
89 DEFINE_URCU_TLS(unsigned long, lookup_fail);
90 DEFINE_URCU_TLS(unsigned long, lookup_ok);
91
92 struct cds_lfht *test_ht;
93
94 volatile int test_go, test_stop;
95
96 unsigned long wdelay;
97
98 unsigned long duration;
99
100 /* read-side C.S. duration, in loops */
101 unsigned long rduration;
102
103 unsigned long init_hash_size = DEFAULT_HASH_SIZE;
104 unsigned long min_hash_alloc_size = DEFAULT_MIN_ALLOC_SIZE;
105 unsigned long max_hash_buckets_size = (1UL << 20);
106 unsigned long init_populate;
107 int opt_auto_resize;
108 int add_only, add_unique, add_replace;
109 const struct cds_lfht_mm_type *memory_backend;
110
111 unsigned long init_pool_offset, lookup_pool_offset, write_pool_offset;
112 unsigned long init_pool_size = DEFAULT_RAND_POOL,
113 lookup_pool_size = DEFAULT_RAND_POOL,
114 write_pool_size = DEFAULT_RAND_POOL;
115 int validate_lookup;
116 unsigned long nr_hash_chains; /* 0: normal table, other: number of hash chains */
117
118 int count_pipe[2];
119
120 int verbose_mode;
121
122 unsigned int cpu_affinities[NR_CPUS];
123 unsigned int next_aff = 0;
124 int use_affinity = 0;
125
126 pthread_mutex_t affinity_mutex = PTHREAD_MUTEX_INITIALIZER;
127
128 DEFINE_URCU_TLS(unsigned long long, nr_writes);
129 DEFINE_URCU_TLS(unsigned long long, nr_reads);
130
131 unsigned int nr_readers;
132 unsigned int nr_writers;
133
134 static pthread_mutex_t rcu_copy_mutex = PTHREAD_MUTEX_INITIALIZER;
135
136 void set_affinity(void)
137 {
138 #if HAVE_SCHED_SETAFFINITY
139 cpu_set_t mask;
140 int cpu, ret;
141 #endif /* HAVE_SCHED_SETAFFINITY */
142
143 if (!use_affinity)
144 return;
145
146 #if HAVE_SCHED_SETAFFINITY
147 ret = pthread_mutex_lock(&affinity_mutex);
148 if (ret) {
149 perror("Error in pthread mutex lock");
150 exit(-1);
151 }
152 cpu = cpu_affinities[next_aff++];
153 ret = pthread_mutex_unlock(&affinity_mutex);
154 if (ret) {
155 perror("Error in pthread mutex unlock");
156 exit(-1);
157 }
158 CPU_ZERO(&mask);
159 CPU_SET(cpu, &mask);
160 sched_setaffinity(0, sizeof(mask), &mask);
161 #endif /* HAVE_SCHED_SETAFFINITY */
162 }
163
164 void rcu_copy_mutex_lock(void)
165 {
166 int ret;
167 ret = pthread_mutex_lock(&rcu_copy_mutex);
168 if (ret) {
169 perror("Error in pthread mutex lock");
170 exit(-1);
171 }
172 }
173
174 void rcu_copy_mutex_unlock(void)
175 {
176 int ret;
177
178 ret = pthread_mutex_unlock(&rcu_copy_mutex);
179 if (ret) {
180 perror("Error in pthread mutex unlock");
181 exit(-1);
182 }
183 }
184
185 unsigned long test_compare(const void *key1, size_t key1_len,
186 const void *key2, size_t key2_len)
187 {
188 if (caa_unlikely(key1_len != key2_len))
189 return -1;
190 assert(key1_len == sizeof(unsigned long));
191 if (key1 == key2)
192 return 0;
193 else
194 return 1;
195 }
196
197 void *thr_count(void *arg)
198 {
199 printf_verbose("thread_begin %s, tid %lu\n",
200 "counter", urcu_get_thread_id());
201
202 rcu_register_thread();
203
204 for (;;) {
205 unsigned long count;
206 long approx_before, approx_after;
207 ssize_t len;
208 char buf[1];
209
210 rcu_thread_offline();
211 len = read(count_pipe[0], buf, 1);
212 rcu_thread_online();
213 if (caa_unlikely(!test_duration_read()))
214 break;
215 if (len != 1)
216 continue;
217 /* Accounting */
218 printf("Counting nodes... ");
219 fflush(stdout);
220 rcu_read_lock();
221 cds_lfht_count_nodes(test_ht, &approx_before, &count,
222 &approx_after);
223 rcu_read_unlock();
224 printf("done.\n");
225 printf("Approximation before node accounting: %ld nodes.\n",
226 approx_before);
227 printf("Accounting of nodes in the hash table: "
228 "%lu nodes.\n",
229 count);
230 printf("Approximation after node accounting: %ld nodes.\n",
231 approx_after);
232 }
233 rcu_unregister_thread();
234 return NULL;
235 }
236
237 void free_node_cb(struct rcu_head *head)
238 {
239 struct lfht_test_node *node =
240 caa_container_of(head, struct lfht_test_node, head);
241 free(node);
242 }
243
244 static
245 void test_delete_all_nodes(struct cds_lfht *ht)
246 {
247 struct cds_lfht_iter iter;
248 struct lfht_test_node *node;
249 unsigned long count = 0;
250
251 cds_lfht_for_each_entry(ht, &iter, node, node) {
252 int ret;
253
254 ret = cds_lfht_del(test_ht, cds_lfht_iter_get_node(&iter));
255 assert(!ret);
256 call_rcu(&node->head, free_node_cb);
257 count++;
258 }
259 printf("deleted %lu nodes.\n", count);
260 }
261
262 void show_usage(int argc, char **argv)
263 {
264 printf("Usage : %s nr_readers nr_writers duration (s) <OPTIONS>\n",
265 argv[0]);
266 printf("OPTIONS:\n");
267 printf(" [-r] [-w] (yield reader and/or writer)\n");
268 printf(" [-d delay] (writer period (us))\n");
269 printf(" [-c duration] (reader C.S. duration (in loops))\n");
270 printf(" [-v] (verbose output)\n");
271 printf(" [-a cpu#] [-a cpu#]... (affinity)\n");
272 printf(" [-h size] (initial number of buckets)\n");
273 printf(" [-m size] (minimum number of allocated buckets)\n");
274 printf(" [-n size] (maximum number of buckets)\n");
275 printf(" [not -u nor -s] Add entries (supports redundant keys).\n");
276 printf(" [-u] Uniquify add (no redundant keys).\n");
277 printf(" [-s] Replace (swap) entries.\n");
278 printf(" [-i] Add only (no removal).\n");
279 printf(" [-k nr_nodes] Number of nodes to insert initially.\n");
280 printf(" [-A] Automatically resize hash table.\n");
281 printf(" [-B order|chunk|mmap] Specify the memory backend.\n");
282 printf(" [-R offset] Lookup pool offset.\n");
283 printf(" [-S offset] Write pool offset.\n");
284 printf(" [-T offset] Init pool offset.\n");
285 printf(" [-M size] Lookup pool size.\n");
286 printf(" [-N size] Write pool size.\n");
287 printf(" [-O size] Init pool size.\n");
288 printf(" [-V] Validate lookups of init values.\n");
289 printf(" (use with filled init pool, same lookup range,\n");
290 printf(" with different write range)\n");
291 printf(" [-U] Uniqueness test.\n");
292 printf(" [-C] Number of hash chains.\n");
293 printf("\n");
294 }
295
296 int main(int argc, char **argv)
297 {
298 pthread_t *tid_reader, *tid_writer;
299 pthread_t tid_count;
300 void *tret;
301 unsigned long long *count_reader;
302 struct wr_count *count_writer;
303 unsigned long long tot_reads = 0, tot_writes = 0,
304 tot_add = 0, tot_add_exist = 0, tot_remove = 0;
305 unsigned long count;
306 long approx_before, approx_after;
307 int i, a, ret, err, mainret = 0;
308 unsigned int i_thr;
309 struct sigaction act;
310 unsigned int remain;
311 unsigned int nr_readers_created = 0, nr_writers_created = 0;
312 long long nr_leaked;
313
314 if (argc < 4) {
315 show_usage(argc, argv);
316 mainret = 1;
317 goto end;
318 }
319
320 err = sscanf(argv[1], "%u", &nr_readers);
321 if (err != 1) {
322 show_usage(argc, argv);
323 mainret = 1;
324 goto end;
325 }
326
327 err = sscanf(argv[2], "%u", &nr_writers);
328 if (err != 1) {
329 show_usage(argc, argv);
330 mainret = 1;
331 goto end;
332 }
333
334 err = sscanf(argv[3], "%lu", &duration);
335 if (err != 1) {
336 show_usage(argc, argv);
337 mainret = 1;
338 goto end;
339 }
340
341 for (i = 4; i < argc; i++) {
342 if (argv[i][0] != '-')
343 continue;
344 switch (argv[i][1]) {
345 case 'r':
346 rcu_debug_yield_enable(RCU_YIELD_READ);
347 break;
348 case 'w':
349 rcu_debug_yield_enable(RCU_YIELD_WRITE);
350 break;
351 case 'a':
352 if (argc < i + 2) {
353 show_usage(argc, argv);
354 mainret = 1;
355 goto end;
356 }
357 a = atoi(argv[++i]);
358 cpu_affinities[next_aff++] = a;
359 use_affinity = 1;
360 printf_verbose("Adding CPU %d affinity\n", a);
361 break;
362 case 'c':
363 if (argc < i + 2) {
364 show_usage(argc, argv);
365 mainret = 1;
366 goto end;
367 }
368 rduration = atol(argv[++i]);
369 break;
370 case 'd':
371 if (argc < i + 2) {
372 show_usage(argc, argv);
373 mainret = 1;
374 goto end;
375 }
376 wdelay = atol(argv[++i]);
377 break;
378 case 'v':
379 verbose_mode = 1;
380 break;
381 case 'h':
382 if (argc < i + 2) {
383 show_usage(argc, argv);
384 mainret = 1;
385 goto end;
386 }
387 init_hash_size = atol(argv[++i]);
388 break;
389 case 'm':
390 if (argc < i + 2) {
391 show_usage(argc, argv);
392 mainret = 1;
393 goto end;
394 }
395 min_hash_alloc_size = atol(argv[++i]);
396 break;
397 case 'n':
398 if (argc < i + 2) {
399 show_usage(argc, argv);
400 mainret = 1;
401 goto end;
402 }
403 max_hash_buckets_size = atol(argv[++i]);
404 break;
405 case 'u':
406 if (add_replace) {
407 printf("Please specify at most one of -s or -u.\n");
408 exit(-1);
409 }
410 add_unique = 1;
411 break;
412 case 's':
413 if (add_unique) {
414 printf("Please specify at most one of -s or -u.\n");
415 exit(-1);
416 }
417 add_replace = 1;
418 break;
419 case 'i':
420 add_only = 1;
421 break;
422 case 'k':
423 init_populate = atol(argv[++i]);
424 break;
425 case 'A':
426 opt_auto_resize = 1;
427 break;
428 case 'B':
429 if (argc < i + 2) {
430 show_usage(argc, argv);
431 mainret = 1;
432 goto end;
433 }
434 i++;
435 if (!strcmp("order", argv[i]))
436 memory_backend = &cds_lfht_mm_order;
437 else if (!strcmp("chunk", argv[i]))
438 memory_backend = &cds_lfht_mm_chunk;
439 else if (!strcmp("mmap", argv[i]))
440 memory_backend = &cds_lfht_mm_mmap;
441 else {
442 printf("Please specify memory backend with order|chunk|mmap.\n");
443 mainret = 1;
444 goto end;
445 }
446 break;
447 case 'R':
448 lookup_pool_offset = atol(argv[++i]);
449 break;
450 case 'S':
451 write_pool_offset = atol(argv[++i]);
452 break;
453 case 'T':
454 init_pool_offset = atol(argv[++i]);
455 break;
456 case 'M':
457 lookup_pool_size = atol(argv[++i]);
458 break;
459 case 'N':
460 write_pool_size = atol(argv[++i]);
461 break;
462 case 'O':
463 init_pool_size = atol(argv[++i]);
464 break;
465 case 'V':
466 validate_lookup = 1;
467 break;
468 case 'U':
469 test_choice = TEST_HASH_UNIQUE;
470 break;
471 case 'C':
472 nr_hash_chains = atol(argv[++i]);
473 break;
474 }
475 }
476
477 /* Check if hash size is power of 2 */
478 if (init_hash_size && init_hash_size & (init_hash_size - 1)) {
479 printf("Error: Initial number of buckets (%lu) is not a power of 2.\n",
480 init_hash_size);
481 mainret = 1;
482 goto end;
483 }
484
485 if (min_hash_alloc_size && min_hash_alloc_size & (min_hash_alloc_size - 1)) {
486 printf("Error: Minimum number of allocated buckets (%lu) is not a power of 2.\n",
487 min_hash_alloc_size);
488 mainret = 1;
489 goto end;
490 }
491
492 if (max_hash_buckets_size && max_hash_buckets_size & (max_hash_buckets_size - 1)) {
493 printf("Error: Maximum number of buckets (%lu) is not a power of 2.\n",
494 max_hash_buckets_size);
495 mainret = 1;
496 goto end;
497 }
498
499 memset(&act, 0, sizeof(act));
500 ret = sigemptyset(&act.sa_mask);
501 if (ret == -1) {
502 perror("sigemptyset");
503 mainret = 1;
504 goto end;
505 }
506 act.sa_handler = get_sigusr1_cb();
507 act.sa_flags = SA_RESTART;
508 ret = sigaction(SIGUSR1, &act, NULL);
509 if (ret == -1) {
510 perror("sigaction");
511 mainret = 1;
512 goto end;
513 }
514
515 act.sa_handler = get_sigusr2_cb();
516 act.sa_flags = SA_RESTART;
517 ret = sigaction(SIGUSR2, &act, NULL);
518 if (ret == -1) {
519 perror("sigaction");
520 mainret = 1;
521 goto end;
522 }
523
524 printf_verbose("running test for %lu seconds, %u readers, %u writers.\n",
525 duration, nr_readers, nr_writers);
526 printf_verbose("Writer delay : %lu loops.\n", wdelay);
527 printf_verbose("Reader duration : %lu loops.\n", rduration);
528 printf_verbose("Mode:%s%s.\n",
529 add_only ? " add only" : " add/remove",
530 add_unique ? " uniquify" : ( add_replace ? " replace" : " insert"));
531 printf_verbose("Initial number of buckets: %lu buckets.\n", init_hash_size);
532 printf_verbose("Minimum number of allocated buckets: %lu buckets.\n", min_hash_alloc_size);
533 printf_verbose("Maximum number of buckets: %lu buckets.\n", max_hash_buckets_size);
534 printf_verbose("Init pool size offset %lu size %lu.\n",
535 init_pool_offset, init_pool_size);
536 printf_verbose("Lookup pool size offset %lu size %lu.\n",
537 lookup_pool_offset, lookup_pool_size);
538 printf_verbose("Update pool size offset %lu size %lu.\n",
539 write_pool_offset, write_pool_size);
540 printf_verbose("Number of hash chains: %lu.\n",
541 nr_hash_chains);
542 printf_verbose("thread %-6s, tid %lu\n",
543 "main", urcu_get_thread_id());
544
545 tid_reader = calloc(nr_readers, sizeof(*tid_reader));
546 if (!tid_reader) {
547 mainret = 1;
548 goto end;
549 }
550 tid_writer = calloc(nr_writers, sizeof(*tid_writer));
551 if (!tid_writer) {
552 mainret = 1;
553 goto end_free_tid_reader;
554 }
555 count_reader = calloc(nr_readers, sizeof(*count_reader));
556 if (!count_reader) {
557 mainret = 1;
558 goto end_free_tid_writer;
559 }
560 count_writer = calloc(nr_writers, sizeof(*count_writer));
561 if (!count_writer) {
562 mainret = 1;
563 goto end_free_count_reader;
564 }
565
566 err = create_all_cpu_call_rcu_data(0);
567 if (err) {
568 printf("Per-CPU call_rcu() worker threads unavailable. Using default global worker thread.\n");
569 }
570
571 if (memory_backend) {
572 test_ht = _cds_lfht_new(init_hash_size, min_hash_alloc_size,
573 max_hash_buckets_size,
574 (opt_auto_resize ? CDS_LFHT_AUTO_RESIZE : 0) |
575 CDS_LFHT_ACCOUNTING, memory_backend,
576 &rcu_flavor, NULL);
577 } else {
578 test_ht = cds_lfht_new(init_hash_size, min_hash_alloc_size,
579 max_hash_buckets_size,
580 (opt_auto_resize ? CDS_LFHT_AUTO_RESIZE : 0) |
581 CDS_LFHT_ACCOUNTING, NULL);
582 }
583 if (!test_ht) {
584 printf("Error allocating hash table.\n");
585 mainret = 1;
586 goto end_free_call_rcu_data;
587 }
588
589 /*
590 * Hash Population needs to be seen as a RCU reader
591 * thread from the point of view of resize.
592 */
593 rcu_register_thread();
594 ret = (get_populate_hash_cb())();
595 assert(!ret);
596
597 rcu_thread_offline();
598
599 next_aff = 0;
600
601 ret = pipe(count_pipe);
602 if (ret == -1) {
603 perror("pipe");
604 mainret = 1;
605 goto end_online;
606 }
607
608 /* spawn counter thread */
609 err = pthread_create(&tid_count, NULL, thr_count,
610 NULL);
611 if (err != 0) {
612 errno = err;
613 mainret = 1;
614 perror("pthread_create");
615 goto end_close_pipe;
616 }
617
618 for (i_thr = 0; i_thr < nr_readers; i_thr++) {
619 err = pthread_create(&tid_reader[i_thr],
620 NULL, get_thr_reader_cb(),
621 &count_reader[i_thr]);
622 if (err != 0) {
623 errno = err;
624 mainret = 1;
625 perror("pthread_create");
626 goto end_pthread_join;
627 }
628 nr_readers_created++;
629 }
630 for (i_thr = 0; i_thr < nr_writers; i_thr++) {
631 err = pthread_create(&tid_writer[i_thr],
632 NULL, get_thr_writer_cb(),
633 &count_writer[i_thr]);
634 if (err != 0) {
635 errno = err;
636 mainret = 1;
637 perror("pthread_create");
638 goto end_pthread_join;
639 }
640 nr_writers_created++;
641 }
642
643 cmm_smp_mb();
644
645 test_go = 1;
646
647 remain = duration;
648 do {
649 remain = sleep(remain);
650 } while (remain > 0);
651
652 test_stop = 1;
653
654 end_pthread_join:
655 for (i_thr = 0; i_thr < nr_readers_created; i_thr++) {
656 err = pthread_join(tid_reader[i_thr], &tret);
657 if (err != 0) {
658 errno = err;
659 mainret = 1;
660 perror("pthread_join");
661 }
662 tot_reads += count_reader[i_thr];
663 }
664 for (i_thr = 0; i_thr < nr_writers_created; i_thr++) {
665 err = pthread_join(tid_writer[i_thr], &tret);
666 if (err != 0) {
667 errno = err;
668 mainret = 1;
669 perror("pthread_join");
670 }
671 tot_writes += count_writer[i_thr].update_ops;
672 tot_add += count_writer[i_thr].add;
673 tot_add_exist += count_writer[i_thr].add_exist;
674 tot_remove += count_writer[i_thr].remove;
675 }
676
677 /* teardown counter thread */
678 act.sa_handler = SIG_IGN;
679 act.sa_flags = SA_RESTART;
680 ret = sigaction(SIGUSR2, &act, NULL);
681 if (ret == -1) {
682 mainret = 1;
683 perror("sigaction");
684 }
685 {
686 char msg[1] = { 0x42 };
687 ssize_t ret;
688
689 do {
690 ret = write(count_pipe[1], msg, 1); /* wakeup thread */
691 } while (ret == -1L && errno == EINTR);
692 }
693 err = pthread_join(tid_count, &tret);
694 if (err != 0) {
695 errno = err;
696 mainret = 1;
697 perror("pthread_join");
698 }
699
700 end_close_pipe:
701 for (i = 0; i < 2; i++) {
702 err = close(count_pipe[i]);
703 if (err) {
704 mainret = 1;
705 perror("close pipe");
706 }
707 }
708 fflush(stdout);
709 end_online:
710 rcu_thread_online();
711 rcu_read_lock();
712 printf("Counting nodes... ");
713 cds_lfht_count_nodes(test_ht, &approx_before, &count, &approx_after);
714 printf("done.\n");
715 test_delete_all_nodes(test_ht);
716 rcu_read_unlock();
717 rcu_thread_offline();
718 if (count) {
719 printf("Approximation before node accounting: %ld nodes.\n",
720 approx_before);
721 printf("Nodes deleted from hash table before destroy: "
722 "%lu nodes.\n",
723 count);
724 printf("Approximation after node accounting: %ld nodes.\n",
725 approx_after);
726 }
727
728 ret = cds_lfht_destroy(test_ht, NULL);
729 if (ret) {
730 printf_verbose("final delete aborted\n");
731 mainret = 1;
732 } else {
733 printf_verbose("final delete success\n");
734 }
735 printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
736 tot_writes);
737 nr_leaked = (long long) tot_add + init_populate - tot_remove - count;
738 printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu "
739 "nr_writers %3u "
740 "wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu "
741 "nr_add %12llu nr_add_fail %12llu nr_remove %12llu nr_leaked %12lld\n",
742 argv[0], duration, nr_readers, rduration,
743 nr_writers, wdelay, tot_reads, tot_writes,
744 tot_reads + tot_writes, tot_add, tot_add_exist, tot_remove,
745 nr_leaked);
746 if (nr_leaked != 0) {
747 mainret = 1;
748 printf("WARNING: %lld nodes were leaked!\n", nr_leaked);
749 }
750
751 rcu_unregister_thread();
752 end_free_call_rcu_data:
753 free_all_cpu_call_rcu_data();
754 free(count_writer);
755 end_free_count_reader:
756 free(count_reader);
757 end_free_tid_writer:
758 free(tid_writer);
759 end_free_tid_reader:
760 free(tid_reader);
761 end:
762 if (!mainret)
763 exit(EXIT_SUCCESS);
764 else
765 exit(EXIT_FAILURE);
766 }
This page took 0.046027 seconds and 4 git commands to generate.