Cleanup: enable signed/unsigned compare compiler warning
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 18 Dec 2018 19:21:22 +0000 (14:21 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 18 Dec 2018 19:24:45 +0000 (14:24 -0500)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
29 files changed:
configure.ac
doc/examples/rculfhash/cds_lfht_add_replace.c
doc/examples/rculfhash/cds_lfht_add_unique.c
doc/examples/rculfhash/cds_lfht_del.c
doc/examples/rculfhash/cds_lfht_for_each_entry_duplicate.c
doc/examples/rculfhash/cds_lfht_lookup.c
src/rculfhash.c
src/urcu-utils.h
tests/benchmark/test_mutex.c
tests/benchmark/test_perthreadlock.c
tests/benchmark/test_perthreadlock_timing.c
tests/benchmark/test_rwlock.c
tests/benchmark/test_rwlock_timing.c
tests/benchmark/test_urcu.c
tests/benchmark/test_urcu_assign.c
tests/benchmark/test_urcu_bp.c
tests/benchmark/test_urcu_defer.c
tests/benchmark/test_urcu_gc.c
tests/benchmark/test_urcu_hash.c
tests/benchmark/test_urcu_lfq.c
tests/benchmark/test_urcu_lfs.c
tests/benchmark/test_urcu_lfs_rcu.c
tests/benchmark/test_urcu_qsbr.c
tests/benchmark/test_urcu_qsbr_gc.c
tests/benchmark/test_urcu_qsbr_timing.c
tests/benchmark/test_urcu_timing.c
tests/benchmark/test_urcu_wfcq.c
tests/benchmark/test_urcu_wfq.c
tests/benchmark/test_urcu_wfs.c

index 017da5a552508718201642785f0fb9d1b0c80450..3879f8fc564cd5d0259998b5d893e3f39e84a0dc 100644 (file)
@@ -381,7 +381,7 @@ AC_CHECK_FUNCS([sched_setaffinity],[
 AM_CPPFLAGS="-include config.h"
 AC_SUBST(AM_CPPFLAGS)
 
 AM_CPPFLAGS="-include config.h"
 AC_SUBST(AM_CPPFLAGS)
 
-AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $AM_CFLAGS"
+AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter $AM_CFLAGS"
 AC_SUBST(AM_CFLAGS)
 
 AC_CONFIG_LINKS([
 AC_SUBST(AM_CFLAGS)
 
 AC_CONFIG_LINKS([
index 19c372675706d9ea7c74775480cd1574d5cdbb50..3b64ee00980fda6aa73230994b16b10195ca676c 100644 (file)
@@ -41,7 +41,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key)
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
-       const unsigned int *key = _key;
+       const int *key = _key;
 
        return *key == node->value;
 }
 
        return *key == node->value;
 }
index 68759713c44c608a19b8c5e48d3fd61c995e5595..23b29f2c0bf194b80715842dbbf252193f7cfee3 100644 (file)
@@ -38,7 +38,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key)
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
-       const unsigned int *key = _key;
+       const int *key = _key;
 
        return *key == node->value;
 }
 
        return *key == node->value;
 }
index efa6d9a705323123a5e68384a253f51f0c1c1c11..f030ee17c6063491130333e5bcbf07989a49c137 100644 (file)
@@ -37,7 +37,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key)
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
-       const unsigned int *key = _key;
+       const int *key = _key;
 
        return *key == node->value;
 }
 
        return *key == node->value;
 }
index 98332803fa606ce1fb949dcd8baf164d5a064372..a975128f5be28397af4348206e94255fc754e05b 100644 (file)
@@ -37,7 +37,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key)
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
-       const unsigned int *key = _key;
+       const int *key = _key;
 
        return *key == node->value;
 }
 
        return *key == node->value;
 }
index 053e6dd9079a0fd090a8c25704d79e58b82bd72b..de2a47f62376af5a5d898f348fdfe4b44d710432 100644 (file)
@@ -37,7 +37,7 @@ int match(struct cds_lfht_node *ht_node, const void *_key)
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
 {
        struct mynode *node =
                caa_container_of(ht_node, struct mynode, node);
-       const unsigned int *key = _key;
+       const int *key = _key;
 
        return *key == node->value;
 }
 
        return *key == node->value;
 }
index e0c5860c7b6b91e448b68b250c5c0a58afd49825..ff42df0aef30ecf567da51014cdd0a7c6235c96f 100644 (file)
 #include <signal.h>
 #include "workqueue.h"
 #include "urcu-die.h"
 #include <signal.h>
 #include "workqueue.h"
 #include "urcu-die.h"
+#include "urcu-utils.h"
 
 /*
  * Split-counters lazily update the global counter each 1024
 
 /*
  * Split-counters lazily update the global counter each 1024
@@ -711,9 +712,8 @@ int ht_get_split_count_index(unsigned long hash)
 static
 void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash)
 {
 static
 void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash)
 {
-       unsigned long split_count;
+       unsigned long split_count, count;
        int index;
        int index;
-       long count;
 
        if (caa_unlikely(!ht->split_count))
                return;
 
        if (caa_unlikely(!ht->split_count))
                return;
@@ -732,7 +732,7 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash)
 
        if ((count >> CHAIN_LEN_RESIZE_THRESHOLD) < size)
                return;
 
        if ((count >> CHAIN_LEN_RESIZE_THRESHOLD) < size)
                return;
-       dbg_printf("add set global %ld\n", count);
+       dbg_printf("add set global %lu\n", count);
        cds_lfht_resize_lazy_count(ht, size,
                count >> (CHAIN_LEN_TARGET - 1));
 }
        cds_lfht_resize_lazy_count(ht, size,
                count >> (CHAIN_LEN_TARGET - 1));
 }
@@ -740,9 +740,8 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size, unsigned long hash)
 static
 void ht_count_del(struct cds_lfht *ht, unsigned long size, unsigned long hash)
 {
 static
 void ht_count_del(struct cds_lfht *ht, unsigned long size, unsigned long hash)
 {
-       unsigned long split_count;
+       unsigned long split_count, count;
        int index;
        int index;
-       long count;
 
        if (caa_unlikely(!ht->split_count))
                return;
 
        if (caa_unlikely(!ht->split_count))
                return;
@@ -1247,8 +1246,8 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
 {
        unsigned long partition_len, start = 0;
        struct partition_resize_work *work;
 {
        unsigned long partition_len, start = 0;
        struct partition_resize_work *work;
-       int thread, ret;
-       unsigned long nr_threads;
+       int ret;
+       unsigned long thread, nr_threads;
 
        assert(nr_cpus_mask != -1);
        if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
 
        assert(nr_cpus_mask != -1);
        if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD)
@@ -1260,7 +1259,7 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i,
         * partition size, up to the number of CPUs in the system.
         */
        if (nr_cpus_mask > 0) {
         * partition size, up to the number of CPUs in the system.
         */
        if (nr_cpus_mask > 0) {
-               nr_threads = min(nr_cpus_mask + 1,
+               nr_threads = min_t(unsigned long, nr_cpus_mask + 1,
                                 len >> MIN_PARTITION_PER_THREAD_ORDER);
        } else {
                nr_threads = 1;
                                 len >> MIN_PARTITION_PER_THREAD_ORDER);
        } else {
                nr_threads = 1;
@@ -1449,8 +1448,7 @@ static
 void fini_table(struct cds_lfht *ht,
                unsigned long first_order, unsigned long last_order)
 {
 void fini_table(struct cds_lfht *ht,
                unsigned long first_order, unsigned long last_order)
 {
-       long i;
-       unsigned long free_by_rcu_order = 0;
+       unsigned long free_by_rcu_order = 0, i;
 
        dbg_printf("fini table: first_order %lu last_order %lu\n",
                   first_order, last_order);
 
        dbg_printf("fini table: first_order %lu last_order %lu\n",
                   first_order, last_order);
@@ -1499,11 +1497,15 @@ void fini_table(struct cds_lfht *ht,
        }
 }
 
        }
 }
 
+/*
+ * Never called with size < 1.
+ */
 static
 void cds_lfht_create_bucket(struct cds_lfht *ht, unsigned long size)
 {
        struct cds_lfht_node *prev, *node;
        unsigned long order, len, i;
 static
 void cds_lfht_create_bucket(struct cds_lfht *ht, unsigned long size)
 {
        struct cds_lfht_node *prev, *node;
        unsigned long order, len, i;
+       int bucket_order;
 
        cds_lfht_alloc_bucket_table(ht, 0);
 
 
        cds_lfht_alloc_bucket_table(ht, 0);
 
@@ -1512,7 +1514,10 @@ void cds_lfht_create_bucket(struct cds_lfht *ht, unsigned long size)
        node->next = flag_bucket(get_end());
        node->reverse_hash = 0;
 
        node->next = flag_bucket(get_end());
        node->reverse_hash = 0;
 
-       for (order = 1; order < cds_lfht_get_count_order_ulong(size) + 1; order++) {
+       bucket_order = cds_lfht_get_count_order_ulong(size);
+       assert(bucket_order >= 0);
+
+       for (order = 1; order < (unsigned long) bucket_order + 1; order++) {
                len = 1UL << (order - 1);
                cds_lfht_alloc_bucket_table(ht, order);
 
                len = 1UL << (order - 1);
                cds_lfht_alloc_bucket_table(ht, order);
 
index eab6212dd61539651aaded7ad747874a6e9d1d92..407f42e07e6fd078d247e707a3058f3aa6cb9dff 100644 (file)
 #define urcu_stringify(a) _urcu_stringify(a)
 #define _urcu_stringify(a) #a
 
 #define urcu_stringify(a) _urcu_stringify(a)
 #define _urcu_stringify(a) #a
 
+#define max_t(type, x, y)                              \
+       ({                                              \
+               type __max1 = (x);                      \
+               type __max2 = (y);                      \
+               __max1 > __max2 ? __max1: __max2;       \
+       })
+
+#define min_t(type, x, y)                              \
+       ({                                              \
+               type __min1 = (x);                      \
+               type __min2 = (y);                      \
+               __min1 <= __min2 ? __min1: __min2;      \
+       })
+
 /* There is no concept of symbol aliases on MacOS */
 #ifdef __APPLE__
 #define URCU_ATTR_ALIAS(x)
 /* There is no concept of symbol aliases on MacOS */
 #ifdef __APPLE__
 #define URCU_ATTR_ALIAS(x)
index 049913c8d8fd62bc11fadffd290805cd2d853384..19eb7c4f929b8cb84d5cea95040f4669a7bcd81f 100644 (file)
@@ -252,6 +252,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -270,7 +271,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -334,15 +335,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -355,17 +356,17 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += tot_nr_reads[i];
+               tot_reads += tot_nr_reads[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += tot_nr_writes[i];
+               tot_writes += tot_nr_writes[i_thr];
        }
 
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
        }
 
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
index 86476a0b9f65763bcbaf3b38c2e41e8e88c04604..512b1fc8ff1dc1f6697c28911ce382cec3c1ebe3 100644 (file)
@@ -263,6 +263,7 @@ int main(int argc, char **argv)
        void *tret;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        void *tret;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -281,7 +282,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -341,21 +342,21 @@ int main(int argc, char **argv)
        tot_nr_reads = calloc(nr_readers, sizeof(*tot_nr_reads));
        tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
        per_thread_lock = calloc(nr_readers, sizeof(*per_thread_lock));
        tot_nr_reads = calloc(nr_readers, sizeof(*tot_nr_reads));
        tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
        per_thread_lock = calloc(nr_readers, sizeof(*per_thread_lock));
-       for (i = 0; i < nr_readers; i++) {
-               pthread_mutex_init(&per_thread_lock[i].lock, NULL);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               pthread_mutex_init(&per_thread_lock[i_thr].lock, NULL);
        }
 
        next_aff = 0;
 
        }
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -368,17 +369,17 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += tot_nr_reads[i];
+               tot_reads += tot_nr_reads[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += tot_nr_writes[i];
+               tot_writes += tot_nr_writes[i_thr];
        }
 
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
        }
 
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
index c9cc65f70736dc441fc7a13b19d9b064ac8ce227..c1cd567242737cef2afddebac28bbb5dfd839369 100644 (file)
@@ -69,7 +69,7 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;
 
 void *thr_reader(void *arg)
 {
 
 void *thr_reader(void *arg)
 {
-       int i, j;
+       unsigned int i, j;
        caa_cycles_t time1, time2;
        long tidx = (long)arg;
 
        caa_cycles_t time1, time2;
        long tidx = (long)arg;
 
@@ -98,7 +98,7 @@ void *thr_reader(void *arg)
 
 void *thr_writer(void *arg)
 {
 
 void *thr_writer(void *arg)
 {
-       int i, j;
+       unsigned int i, j;
        long tidx;
        caa_cycles_t time1, time2;
 
        long tidx;
        caa_cycles_t time1, time2;
 
index 827c117eb9a7c792e09274fd8169de25b2580050..4628080e3ba30846ad65a11fcbbec6c0329dfca4 100644 (file)
@@ -277,6 +277,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -364,15 +365,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    &count_writer[i]);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    &count_writer[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -385,17 +386,17 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += count_writer[i];
+               tot_writes += count_writer[i_thr];
        }
 
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
        }
 
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
index bc51c45c3573a6b9611673048a2cefacaacce629..0cc5253b7085c3426704ad9d5a2656d46bc51c9c 100644 (file)
@@ -69,7 +69,8 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;
 
 void *thr_reader(void *arg)
 {
 
 void *thr_reader(void *arg)
 {
-       int i, j, ret;
+       unsigned int i, j;
+       int ret;
        caa_cycles_t time1, time2;
 
        printf("thread_begin %s, tid %lu\n",
        caa_cycles_t time1, time2;
 
        printf("thread_begin %s, tid %lu\n",
@@ -107,7 +108,8 @@ void *thr_reader(void *arg)
 
 void *thr_writer(void *arg)
 {
 
 void *thr_writer(void *arg)
 {
-       int i, j, ret;
+       unsigned int i, j;
+       int ret;
        caa_cycles_t time1, time2;
 
        printf("thread_begin %s, tid %lu\n",
        caa_cycles_t time1, time2;
 
        printf("thread_begin %s, tid %lu\n",
index 5670d1e9f9355271b1b8a66f5e0373328d175049..24758a763d022b6c9eb9cbdfe48767d718ef0347 100644 (file)
@@ -261,6 +261,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -278,7 +279,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -346,15 +347,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    &count_writer[i]);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    &count_writer[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -367,19 +368,19 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += count_writer[i];
+               tot_writes += count_writer[i_thr];
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
index fe34af3971a29322f78fb3c9c43de3310e2d1b73..eaa04b32e416e2ee20ad276d029e0544bf1ef31f 100644 (file)
@@ -165,8 +165,8 @@ void rcu_copy_mutex_unlock(void)
  * both alloc and free, which insures we never run over our tail.
  */
 #define ARRAY_SIZE (1048576 * nr_writers)
  * both alloc and free, which insures we never run over our tail.
  */
 #define ARRAY_SIZE (1048576 * nr_writers)
-#define ARRAY_POISON 0xDEADBEEF
-static int array_index;
+#define ARRAY_POISON (int) 0xDEADBEEF
+static unsigned int array_index;
 static struct test_array *test_array;
 
 static struct test_array *test_array_alloc(void)
 static struct test_array *test_array;
 
 static struct test_array *test_array_alloc(void)
@@ -294,6 +294,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -311,7 +312,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -380,15 +381,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    &count_writer[i]);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    &count_writer[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -401,19 +402,19 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += count_writer[i];
+               tot_writes += count_writer[i_thr];
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
@@ -422,11 +423,13 @@ int main(int argc, char **argv)
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes);
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes);
+
        test_array_free(test_rcu_pointer);
        free(test_array);
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(count_writer);
        test_array_free(test_rcu_pointer);
        free(test_array);
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(count_writer);
+
        return 0;
 }
        return 0;
 }
index 52b0a2acba6a1f52456c1fbcab50895a5ae7267e..86b0b022245aadd18d7c306f08ff7ee460e58c95 100644 (file)
@@ -256,6 +256,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -273,7 +274,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -341,15 +342,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    &count_writer[i]);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    &count_writer[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -362,19 +363,19 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += count_writer[i];
+               tot_writes += count_writer[i_thr];
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
@@ -383,10 +384,12 @@ int main(int argc, char **argv)
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes);
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes);
+
        free(test_rcu_pointer);
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(count_writer);
        free(test_rcu_pointer);
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(count_writer);
+
        return 0;
 }
        return 0;
 }
index 0a4964176cd7c77b331019f1cd29ea21d957f1aa..df8e335ec898a396e6ed4958ac9e76e419a6038c 100644 (file)
@@ -283,6 +283,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -300,7 +301,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -368,15 +369,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -389,19 +390,19 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += tot_nr_writes[i];
+               tot_writes += tot_nr_writes[i_thr];
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
index 0d8e9a4a537ddca9bbf266691f2a01b2ad477fba..1e50e4c5f4a369bed7f775cab7417cb872d743ea 100644 (file)
@@ -304,6 +304,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -321,7 +322,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -394,28 +395,29 @@ int main(int argc, char **argv)
        count_reader = calloc(nr_readers, sizeof(*count_reader));
        tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
        pending_reclaims = calloc(nr_writers, sizeof(*pending_reclaims));
        count_reader = calloc(nr_readers, sizeof(*count_reader));
        tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
        pending_reclaims = calloc(nr_writers, sizeof(*pending_reclaims));
-       if (reclaim_batch * sizeof(*pending_reclaims[i].queue)
+
+       if (reclaim_batch * sizeof(*pending_reclaims[0].queue)
                        < CAA_CACHE_LINE_SIZE)
                        < CAA_CACHE_LINE_SIZE)
-               for (i = 0; i < nr_writers; i++)
-                       pending_reclaims[i].queue = calloc(1, CAA_CACHE_LINE_SIZE);
+               for (i_thr = 0; i_thr < nr_writers; i_thr++)
+                       pending_reclaims[i_thr].queue = calloc(1, CAA_CACHE_LINE_SIZE);
        else
        else
-               for (i = 0; i < nr_writers; i++)
-                       pending_reclaims[i].queue = calloc(reclaim_batch,
-                                       sizeof(*pending_reclaims[i].queue));
-       for (i = 0; i < nr_writers; i++)
-               pending_reclaims[i].head = pending_reclaims[i].queue;
+               for (i_thr = 0; i_thr < nr_writers; i_thr++)
+                       pending_reclaims[i_thr].queue = calloc(reclaim_batch,
+                                       sizeof(*pending_reclaims[i_thr].queue));
+       for (i_thr = 0; i_thr < nr_writers; i_thr++)
+               pending_reclaims[i_thr].head = pending_reclaims[i_thr].queue;
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -428,20 +430,20 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += tot_nr_writes[i];
-               rcu_gc_clear_queue(i);
+               tot_writes += tot_nr_writes[i_thr];
+               rcu_gc_clear_queue(i_thr);
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
@@ -451,12 +453,14 @@ int main(int argc, char **argv)
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes, reclaim_batch);
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes, reclaim_batch);
+
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(tot_nr_writes);
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(tot_nr_writes);
-       for (i = 0; i < nr_writers; i++)
-               free(pending_reclaims[i].queue);
+
+       for (i_thr = 0; i_thr < nr_writers; i_thr++)
+               free(pending_reclaims[i_thr].queue);
        free(pending_reclaims);
 
        return 0;
        free(pending_reclaims);
 
        return 0;
index 39bdcf8853a7ca32826c59e8801ab9e49fbcbb03..376f3b15075063653c1995d9eab1a690c28c7ccf 100644 (file)
@@ -309,6 +309,7 @@ int main(int argc, char **argv)
        unsigned long count;
        long approx_before, approx_after;
        int i, a, ret, err, mainret = 0;
        unsigned long count;
        long approx_before, approx_after;
        int i, a, ret, err, mainret = 0;
+       unsigned int i_thr;
        struct sigaction act;
        unsigned int remain;
        unsigned int nr_readers_created = 0, nr_writers_created = 0;
        struct sigaction act;
        unsigned int remain;
        unsigned int nr_readers_created = 0, nr_writers_created = 0;
@@ -333,7 +334,7 @@ int main(int argc, char **argv)
                mainret = 1;
                goto end;
        }
                mainret = 1;
                goto end;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -618,10 +619,10 @@ int main(int argc, char **argv)
                goto end_close_pipe;
        }
 
                goto end_close_pipe;
        }
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i],
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr],
                                     NULL, get_thr_reader_cb(),
                                     NULL, get_thr_reader_cb(),
-                                    &count_reader[i]);
+                                    &count_reader[i_thr]);
                if (err != 0) {
                        errno = err;
                        mainret = 1;
                if (err != 0) {
                        errno = err;
                        mainret = 1;
@@ -630,10 +631,10 @@ int main(int argc, char **argv)
                }
                nr_readers_created++;
        }
                }
                nr_readers_created++;
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i],
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr],
                                     NULL, get_thr_writer_cb(),
                                     NULL, get_thr_writer_cb(),
-                                    &count_writer[i]);
+                                    &count_writer[i_thr]);
                if (err != 0) {
                        errno = err;
                        mainret = 1;
                if (err != 0) {
                        errno = err;
                        mainret = 1;
@@ -655,26 +656,26 @@ int main(int argc, char **argv)
        test_stop = 1;
 
 end_pthread_join:
        test_stop = 1;
 
 end_pthread_join:
-       for (i = 0; i < nr_readers_created; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers_created; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0) {
                        errno = err;
                        mainret = 1;
                        perror("pthread_join");
                }
                if (err != 0) {
                        errno = err;
                        mainret = 1;
                        perror("pthread_join");
                }
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers_created; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers_created; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0) {
                        errno = err;
                        mainret = 1;
                        perror("pthread_join");
                }
                if (err != 0) {
                        errno = err;
                        mainret = 1;
                        perror("pthread_join");
                }
-               tot_writes += count_writer[i].update_ops;
-               tot_add += count_writer[i].add;
-               tot_add_exist += count_writer[i].add_exist;
-               tot_remove += count_writer[i].remove;
+               tot_writes += count_writer[i_thr].update_ops;
+               tot_add += count_writer[i_thr].add;
+               tot_add_exist += count_writer[i_thr].add_exist;
+               tot_remove += count_writer[i_thr].remove;
        }
 
        /* teardown counter thread */
        }
 
        /* teardown counter thread */
index 5ef96e66579c35341016a71b80e195dbfcd04ab4..26247b50022f8e3ecaf27acdc5f6d12fcfece758 100644 (file)
@@ -282,6 +282,7 @@ int main(int argc, char **argv)
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -299,7 +300,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -360,15 +361,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
-                                    &count_enqueuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_create(&tid_enqueuer[i_thr], NULL, thr_enqueuer,
+                                    &count_enqueuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_create(&tid_dequeuer[i], NULL, thr_dequeuer,
-                                    &count_dequeuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_create(&tid_dequeuer[i_thr], NULL, thr_dequeuer,
+                                    &count_dequeuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -377,7 +378,7 @@ int main(int argc, char **argv)
 
        test_go = 1;
 
 
        test_go = 1;
 
-       for (i = 0; i < duration; i++) {
+       for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
@@ -387,21 +388,21 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_join(tid_enqueuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_join(tid_enqueuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_enqueues += count_enqueuer[2 * i];
-               tot_successful_enqueues += count_enqueuer[2 * i + 1];
+               tot_enqueues += count_enqueuer[2 * i_thr];
+               tot_successful_enqueues += count_enqueuer[2 * i_thr + 1];
        }
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_join(tid_dequeuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_join(tid_dequeuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_dequeues += count_dequeuer[2 * i];
-               tot_successful_dequeues += count_dequeuer[2 * i + 1];
+               tot_dequeues += count_dequeuer[2 * i_thr];
+               tot_successful_dequeues += count_dequeuer[2 * i_thr + 1];
        }
        }
-       
+
        test_end(&q, &end_dequeues);
        err = cds_lfq_destroy_rcu(&q);
        assert(!err);
        test_end(&q, &end_dequeues);
        err = cds_lfq_destroy_rcu(&q);
        assert(!err);
@@ -432,5 +433,6 @@ int main(int argc, char **argv)
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
+
        return 0;
 }
        return 0;
 }
index 38e99bff20cd47d2ece2aa51d21dd17f370e10f2..2f6ee25a4266c7af2372a5151144f2e9f8b526c0 100644 (file)
@@ -349,6 +349,7 @@ int main(int argc, char **argv)
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -366,7 +367,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -448,15 +449,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
-                                    &count_enqueuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_create(&tid_enqueuer[i_thr], NULL, thr_enqueuer,
+                                    &count_enqueuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_create(&tid_dequeuer[i], NULL, thr_dequeuer,
-                                    &count_dequeuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_create(&tid_dequeuer[i_thr], NULL, thr_dequeuer,
+                                    &count_dequeuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -465,7 +466,7 @@ int main(int argc, char **argv)
 
        test_go = 1;
 
 
        test_go = 1;
 
-       for (i = 0; i < duration; i++) {
+       for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
@@ -475,21 +476,21 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_join(tid_enqueuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_join(tid_enqueuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_enqueues += count_enqueuer[2 * i];
-               tot_successful_enqueues += count_enqueuer[2 * i + 1];
+               tot_enqueues += count_enqueuer[2 * i_thr];
+               tot_successful_enqueues += count_enqueuer[2 * i_thr + 1];
        }
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_join(tid_dequeuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_join(tid_dequeuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_dequeues += count_dequeuer[2 * i];
-               tot_successful_dequeues += count_dequeuer[2 * i + 1];
+               tot_dequeues += count_dequeuer[2 * i_thr];
+               tot_successful_dequeues += count_dequeuer[2 * i_thr + 1];
        }
        }
-       
+
        test_end(&s, &end_dequeues);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
        test_end(&s, &end_dequeues);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
@@ -519,5 +520,6 @@ int main(int argc, char **argv)
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
+
        return 0;
 }
        return 0;
 }
index 9e0bfad44a9adfb98376b0097b662bb2dc4cba49..d0e80db51b451de612ab3c247bb029011a8a637b 100644 (file)
@@ -284,6 +284,7 @@ int main(int argc, char **argv)
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -301,7 +302,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -362,15 +363,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
-                                    &count_enqueuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_create(&tid_enqueuer[i_thr], NULL, thr_enqueuer,
+                                    &count_enqueuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_create(&tid_dequeuer[i], NULL, thr_dequeuer,
-                                    &count_dequeuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_create(&tid_dequeuer[i_thr], NULL, thr_dequeuer,
+                                    &count_dequeuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -379,7 +380,7 @@ int main(int argc, char **argv)
 
        test_go = 1;
 
 
        test_go = 1;
 
-       for (i = 0; i < duration; i++) {
+       for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
@@ -389,21 +390,21 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_join(tid_enqueuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_join(tid_enqueuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_enqueues += count_enqueuer[2 * i];
-               tot_successful_enqueues += count_enqueuer[2 * i + 1];
+               tot_enqueues += count_enqueuer[2 * i_thr];
+               tot_successful_enqueues += count_enqueuer[2 * i_thr + 1];
        }
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_join(tid_dequeuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_join(tid_dequeuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_dequeues += count_dequeuer[2 * i];
-               tot_successful_dequeues += count_dequeuer[2 * i + 1];
+               tot_dequeues += count_dequeuer[2 * i_thr];
+               tot_successful_dequeues += count_dequeuer[2 * i_thr + 1];
        }
        }
-       
+
        test_end(&s, &end_dequeues);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
        test_end(&s, &end_dequeues);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
index 1fcdfb194f383349284a0c15006dd61233038969..962476c0be054ace287e229f4726dad2b361a2ea 100644 (file)
@@ -267,6 +267,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader, *count_writer;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -284,7 +285,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -352,15 +353,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    &count_writer[i]);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    &count_writer[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -373,19 +374,19 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += count_writer[i];
+               tot_writes += count_writer[i_thr];
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
index 7e452d98426a260d55b27f72660e02c88d79d72a..11f0359fac1be97158b4bc8a40775d7a08c5f172 100644 (file)
@@ -306,6 +306,7 @@ int main(int argc, char **argv)
        unsigned long long *count_reader;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
        unsigned long long *count_reader;
        unsigned long long tot_reads = 0, tot_writes = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -323,7 +324,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -396,28 +397,28 @@ int main(int argc, char **argv)
        count_reader = calloc(nr_readers, sizeof(*count_reader));
        tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
        pending_reclaims = calloc(nr_writers, sizeof(*pending_reclaims));
        count_reader = calloc(nr_readers, sizeof(*count_reader));
        tot_nr_writes = calloc(nr_writers, sizeof(*tot_nr_writes));
        pending_reclaims = calloc(nr_writers, sizeof(*pending_reclaims));
-       if (reclaim_batch * sizeof(*pending_reclaims[i].queue)
+       if (reclaim_batch * sizeof(*pending_reclaims[0].queue)
                        < CAA_CACHE_LINE_SIZE)
                        < CAA_CACHE_LINE_SIZE)
-               for (i = 0; i < nr_writers; i++)
-                       pending_reclaims[i].queue = calloc(1, CAA_CACHE_LINE_SIZE);
+               for (i_thr = 0; i_thr < nr_writers; i_thr++)
+                       pending_reclaims[i_thr].queue = calloc(1, CAA_CACHE_LINE_SIZE);
        else
        else
-               for (i = 0; i < nr_writers; i++)
-                       pending_reclaims[i].queue = calloc(reclaim_batch,
-                                       sizeof(*pending_reclaims[i].queue));
-       for (i = 0; i < nr_writers; i++)
-               pending_reclaims[i].head = pending_reclaims[i].queue;
+               for (i_thr = 0; i_thr < nr_writers; i_thr++)
+                       pending_reclaims[i_thr].queue = calloc(reclaim_batch,
+                                       sizeof(*pending_reclaims[i_thr].queue));
+       for (i_thr = 0; i_thr < nr_writers; i_thr++)
+               pending_reclaims[i_thr].head = pending_reclaims[i_thr].queue;
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_create(&tid_reader[i], NULL, thr_reader,
-                                    &count_reader[i]);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_create(&tid_reader[i_thr], NULL, thr_reader,
+                                    &count_reader[i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_create(&tid_writer[i], NULL, thr_writer,
-                                    (void *)(long)i);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_create(&tid_writer[i_thr], NULL, thr_writer,
+                                    (void *)(long)i_thr);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -430,20 +431,20 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_readers; i++) {
-               err = pthread_join(tid_reader[i], &tret);
+       for (i_thr = 0; i_thr < nr_readers; i_thr++) {
+               err = pthread_join(tid_reader[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_reads += count_reader[i];
+               tot_reads += count_reader[i_thr];
        }
        }
-       for (i = 0; i < nr_writers; i++) {
-               err = pthread_join(tid_writer[i], &tret);
+       for (i_thr = 0; i_thr < nr_writers; i_thr++) {
+               err = pthread_join(tid_writer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_writes += tot_nr_writes[i];
-               rcu_gc_clear_queue(i);
+               tot_writes += tot_nr_writes[i_thr];
+               rcu_gc_clear_queue(i_thr);
        }
        }
-       
+
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
        printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
               tot_writes);
        printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu wdur %6lu "
@@ -453,12 +454,14 @@ int main(int argc, char **argv)
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes, reclaim_batch);
                argv[0], duration, nr_readers, rduration, wduration,
                nr_writers, wdelay, tot_reads, tot_writes,
                tot_reads + tot_writes, reclaim_batch);
+
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(tot_nr_writes);
        free(tid_reader);
        free(tid_writer);
        free(count_reader);
        free(tot_nr_writes);
-       for (i = 0; i < nr_writers; i++)
-               free(pending_reclaims[i].queue);
+
+       for (i_thr = 0; i_thr < nr_writers; i_thr++)
+               free(pending_reclaims[i_thr].queue);
        free(pending_reclaims);
 
        return 0;
        free(pending_reclaims);
 
        return 0;
index 7619390e35f854df7020d8452e9dfd03420de540..75e6faa3b45c6f005123ae807e7df986ec362147 100644 (file)
@@ -85,7 +85,7 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;
 
 void *thr_reader(void *arg)
 {
 
 void *thr_reader(void *arg)
 {
-       int i, j;
+       unsigned int i, j;
        struct test_array *local_ptr;
        caa_cycles_t time1, time2;
 
        struct test_array *local_ptr;
        caa_cycles_t time1, time2;
 
@@ -122,7 +122,7 @@ void *thr_reader(void *arg)
 
 void *thr_writer(void *arg)
 {
 
 void *thr_writer(void *arg)
 {
-       int i, j;
+       unsigned int i, j;
        struct test_array *new, *old;
        caa_cycles_t time1, time2;
 
        struct test_array *new, *old;
        caa_cycles_t time1, time2;
 
index d586b1d25faea6d5b02ebe220e006e6e063ca4ce..b5f3e4a81bb4af0e0f1f97dd8ded9cbc9d6c5434 100644 (file)
@@ -85,7 +85,7 @@ static caa_cycles_t __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *writer_time;
 
 void *thr_reader(void *arg)
 {
 
 void *thr_reader(void *arg)
 {
-       int i, j;
+       unsigned int i, j;
        struct test_array *local_ptr;
        caa_cycles_t time1, time2;
 
        struct test_array *local_ptr;
        caa_cycles_t time1, time2;
 
@@ -121,7 +121,7 @@ void *thr_reader(void *arg)
 
 void *thr_writer(void *arg)
 {
 
 void *thr_writer(void *arg)
 {
-       int i, j;
+       unsigned int i, j;
        struct test_array *new, *old;
        caa_cycles_t time1, time2;
 
        struct test_array *new, *old;
        caa_cycles_t time1, time2;
 
index 84a0d0f69068b90596c967475259f06ae000422b..6b5e9331ab7ab2b01aaaee9a66a0d25fc5441aa0 100644 (file)
@@ -75,7 +75,7 @@ static inline void loop_sleep(unsigned long loops)
 static int verbose_mode;
 
 static int test_dequeue, test_splice, test_wait_empty;
 static int verbose_mode;
 
 static int test_dequeue, test_splice, test_wait_empty;
-static int test_enqueue_stopped;
+static unsigned int test_enqueue_stopped;
 
 #define printf_verbose(fmt, args...)           \
        do {                                    \
 
 #define printf_verbose(fmt, args...)           \
        do {                                    \
@@ -357,6 +357,7 @@ int main(int argc, char **argv)
                           tot_splice = 0, tot_dequeue_last = 0;
        unsigned long long end_dequeues = 0;
        int i, a, retval = 0;
                           tot_splice = 0, tot_dequeue_last = 0;
        unsigned long long end_dequeues = 0;
        int i, a, retval = 0;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -374,7 +375,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -471,15 +472,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
-                                    &count_enqueuer[3 * i]);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_create(&tid_enqueuer[i_thr], NULL, thr_enqueuer,
+                                    &count_enqueuer[3 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_create(&tid_dequeuer[i], NULL, thr_dequeuer,
-                                    &count_dequeuer[4 * i]);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_create(&tid_dequeuer[i_thr], NULL, thr_dequeuer,
+                                    &count_dequeuer[4 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -488,7 +489,7 @@ int main(int argc, char **argv)
 
        test_go = 1;
 
 
        test_go = 1;
 
-       for (i = 0; i < duration; i++) {
+       for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
@@ -509,24 +510,24 @@ int main(int argc, char **argv)
 
        test_stop_dequeue = 1;
 
 
        test_stop_dequeue = 1;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_join(tid_enqueuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_join(tid_enqueuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_enqueues += count_enqueuer[3 * i];
-               tot_successful_enqueues += count_enqueuer[3 * i + 1];
-               tot_empty_dest_enqueues += count_enqueuer[3 * i + 2];
+               tot_enqueues += count_enqueuer[3 * i_thr];
+               tot_successful_enqueues += count_enqueuer[3 * i_thr + 1];
+               tot_empty_dest_enqueues += count_enqueuer[3 * i_thr + 2];
        }
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_join(tid_dequeuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_join(tid_dequeuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_dequeues += count_dequeuer[4 * i];
-               tot_successful_dequeues += count_dequeuer[4 * i + 1];
-               tot_splice += count_dequeuer[4 * i + 2];
-               tot_dequeue_last += count_dequeuer[4 * i + 3];
+               tot_dequeues += count_dequeuer[4 * i_thr];
+               tot_successful_dequeues += count_dequeuer[4 * i_thr + 1];
+               tot_splice += count_dequeuer[4 * i_thr + 2];
+               tot_dequeue_last += count_dequeuer[4 * i_thr + 3];
        }
        }
-       
+
        test_end(&end_dequeues, &tot_dequeue_last);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
        test_end(&end_dequeues, &tot_dequeue_last);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
@@ -579,5 +580,6 @@ int main(int argc, char **argv)
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
+
        return retval;
 }
        return retval;
 }
index 1cf356ec7695c037418e7a4e567d85af41439cf5..76821047104a9660edd6cc439ee723f937fe3c21 100644 (file)
@@ -254,6 +254,7 @@ int main(int argc, char **argv)
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
                           tot_successful_dequeues = 0;
        unsigned long long end_dequeues = 0;
        int i, a;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -271,7 +272,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -328,15 +329,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
-                                    &count_enqueuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_create(&tid_enqueuer[i_thr], NULL, thr_enqueuer,
+                                    &count_enqueuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_create(&tid_dequeuer[i], NULL, thr_dequeuer,
-                                    &count_dequeuer[2 * i]);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_create(&tid_dequeuer[i_thr], NULL, thr_dequeuer,
+                                    &count_dequeuer[2 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -345,7 +346,7 @@ int main(int argc, char **argv)
 
        test_go = 1;
 
 
        test_go = 1;
 
-       for (i = 0; i < duration; i++) {
+       for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
@@ -355,21 +356,21 @@ int main(int argc, char **argv)
 
        test_stop = 1;
 
 
        test_stop = 1;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_join(tid_enqueuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_join(tid_enqueuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_enqueues += count_enqueuer[2 * i];
-               tot_successful_enqueues += count_enqueuer[2 * i + 1];
+               tot_enqueues += count_enqueuer[2 * i_thr];
+               tot_successful_enqueues += count_enqueuer[2 * i_thr + 1];
        }
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_join(tid_dequeuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_join(tid_dequeuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_dequeues += count_dequeuer[2 * i];
-               tot_successful_dequeues += count_dequeuer[2 * i + 1];
+               tot_dequeues += count_dequeuer[2 * i_thr];
+               tot_successful_dequeues += count_dequeuer[2 * i_thr + 1];
        }
        }
-       
+
        test_end(&q, &end_dequeues);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
        test_end(&q, &end_dequeues);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
@@ -398,5 +399,6 @@ int main(int argc, char **argv)
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
+
        return 0;
 }
        return 0;
 }
index 266884d441e93bf37d792450a51bcdb1384a9e54..2c82c019577a5454fef2047c1c570b5813d26465 100644 (file)
@@ -78,7 +78,7 @@ static inline void loop_sleep(unsigned long loops)
 static int verbose_mode;
 
 static int test_pop, test_pop_all, test_wait_empty;
 static int verbose_mode;
 
 static int test_pop, test_pop_all, test_wait_empty;
-static int test_enqueue_stopped;
+static unsigned int test_enqueue_stopped;
 
 #define printf_verbose(fmt, args...)           \
        do {                                    \
 
 #define printf_verbose(fmt, args...)           \
        do {                                    \
@@ -344,6 +344,7 @@ int main(int argc, char **argv)
                           tot_pop_all = 0, tot_pop_last = 0;
        unsigned long long end_dequeues = 0;
        int i, a, retval = 0;
                           tot_pop_all = 0, tot_pop_last = 0;
        unsigned long long end_dequeues = 0;
        int i, a, retval = 0;
+       unsigned int i_thr;
 
        if (argc < 4) {
                show_usage(argc, argv);
 
        if (argc < 4) {
                show_usage(argc, argv);
@@ -361,7 +362,7 @@ int main(int argc, char **argv)
                show_usage(argc, argv);
                return -1;
        }
                show_usage(argc, argv);
                return -1;
        }
-       
+
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
        err = sscanf(argv[3], "%lu", &duration);
        if (err != 1) {
                show_usage(argc, argv);
@@ -458,15 +459,15 @@ int main(int argc, char **argv)
 
        next_aff = 0;
 
 
        next_aff = 0;
 
-       for (i = 0; i < nr_enqueuers; i++) {
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
                err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
                err = pthread_create(&tid_enqueuer[i], NULL, thr_enqueuer,
-                                    &count_enqueuer[3 * i]);
+                                    &count_enqueuer[3 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_create(&tid_dequeuer[i], NULL, thr_dequeuer,
-                                    &count_dequeuer[4 * i]);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_create(&tid_dequeuer[i_thr], NULL, thr_dequeuer,
+                                    &count_dequeuer[4 * i_thr]);
                if (err != 0)
                        exit(1);
        }
                if (err != 0)
                        exit(1);
        }
@@ -475,7 +476,7 @@ int main(int argc, char **argv)
 
        test_go = 1;
 
 
        test_go = 1;
 
-       for (i = 0; i < duration; i++) {
+       for (i_thr = 0; i_thr < duration; i_thr++) {
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
                sleep(1);
                if (verbose_mode) {
                        fwrite(".", sizeof(char), 1, stdout);
@@ -496,24 +497,24 @@ int main(int argc, char **argv)
 
        test_stop_dequeue = 1;
 
 
        test_stop_dequeue = 1;
 
-       for (i = 0; i < nr_enqueuers; i++) {
-               err = pthread_join(tid_enqueuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_enqueuers; i_thr++) {
+               err = pthread_join(tid_enqueuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_enqueues += count_enqueuer[3 * i];
-               tot_successful_enqueues += count_enqueuer[3 * i + 1];
-               tot_empty_dest_enqueues += count_enqueuer[3 * i + 2];
+               tot_enqueues += count_enqueuer[3 * i_thr];
+               tot_successful_enqueues += count_enqueuer[3 * i_thr + 1];
+               tot_empty_dest_enqueues += count_enqueuer[3 * i_thr + 2];
        }
        }
-       for (i = 0; i < nr_dequeuers; i++) {
-               err = pthread_join(tid_dequeuer[i], &tret);
+       for (i_thr = 0; i_thr < nr_dequeuers; i_thr++) {
+               err = pthread_join(tid_dequeuer[i_thr], &tret);
                if (err != 0)
                        exit(1);
                if (err != 0)
                        exit(1);
-               tot_dequeues += count_dequeuer[4 * i];
-               tot_successful_dequeues += count_dequeuer[4 * i + 1];
-               tot_pop_all += count_dequeuer[4 * i + 2];
-               tot_pop_last += count_dequeuer[4 * i + 3];
+               tot_dequeues += count_dequeuer[4 * i_thr];
+               tot_successful_dequeues += count_dequeuer[4 * i_thr + 1];
+               tot_pop_all += count_dequeuer[4 * i_thr + 2];
+               tot_pop_last += count_dequeuer[4 * i_thr + 3];
        }
        }
-       
+
        test_end(&s, &end_dequeues, &tot_pop_last);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
        test_end(&s, &end_dequeues, &tot_pop_last);
 
        printf_verbose("total number of enqueues : %llu, dequeues %llu\n",
@@ -557,10 +558,12 @@ int main(int argc, char **argv)
                        tot_pop_last);
                retval = 1;
        }
                        tot_pop_last);
                retval = 1;
        }
+
        cds_wfs_destroy(&s);
        free(count_enqueuer);
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
        cds_wfs_destroy(&s);
        free(count_enqueuer);
        free(count_dequeuer);
        free(tid_enqueuer);
        free(tid_dequeuer);
+
        return retval;
 }
        return retval;
 }
This page took 0.076561 seconds and 4 git commands to generate.