Fix: test initial population needs QS
[userspace-rcu.git] / tests / test_urcu_ja_range.c
index 898adafc126a74b7cf9a4d26b668ef7d4cdb62b1..18f36d5f4d9826993b8480c5294dcc17b7651c06 100644 (file)
@@ -71,7 +71,7 @@ DEFINE_URCU_TLS(unsigned long long, nr_reads);
 unsigned int nr_readers;
 unsigned int nr_writers;
 
-static unsigned int add_ratio = 50;
+static unsigned int add_ratio = 50, range_max_len = 0;
 static uint64_t key_mul = 1ULL;
 
 static int add_unique, add_replace;
@@ -159,6 +159,7 @@ printf("        [not -u nor -s] Add entries (supports redundant keys).\n");
        printf("        [-B] Key bits for multithread test (default: 32).\n");
        printf("        [-m factor] Key multiplication factor.\n");
        printf("        [-l] Memory leak detection.\n");
+       printf("        [-L len] Range max len.\n");
        printf("\n\n");
 }
 
@@ -295,6 +296,9 @@ void *test_ja_rw_thr_writer(void *_count)
                                start = end;
                                end = tmp;
                        }
+                       if (end - start > range_max_len) {
+                               end = start + range_max_len;
+                       }
                        rcu_read_lock();
                        ret = cds_ja_range_add(test_ja, start, end, NULL);
                        if (ret) {
@@ -379,6 +383,9 @@ int do_mt_populate_ja(void)
                URCU_TLS(nr_add)++;
                URCU_TLS(nr_writes)++;
                rcu_read_unlock();
+               /* Hash table resize only occurs in call_rcu thread */
+               if (!(iter % 100))
+                       rcu_quiescent_state();
                if (ret) {
                        fprintf(stderr, "Error (%d) adding range %" PRIu64 "\n",
                                ret, key);
@@ -405,8 +412,9 @@ int do_mt_test(void)
        count_reader = malloc(sizeof(*count_reader) * nr_readers);
        count_writer = malloc(sizeof(*count_writer) * nr_writers);
 
-       printf("Allocating Judy Array for ranges\n");
-       test_ja = cds_ja_range_new();
+       printf("Allocating %u-bit Judy Array for ranges\n",
+               key_bits);
+       test_ja = cds_ja_range_new(key_bits);
        if (!test_ja) {
                printf("Error allocating judy array.\n");
                ret = -1;
@@ -593,6 +601,9 @@ int main(int argc, char **argv)
                case 'l':
                        leak_detection = 1;
                        break;
+               case 'L':
+                       range_max_len = atol(argv[++i]);
+                       break;
                }
        }
 
@@ -611,6 +622,8 @@ int main(int argc, char **argv)
                lookup_pool_offset, lookup_pool_size);
        printf_verbose("Update pool size offset %lu size %lu.\n",
                write_pool_offset, write_pool_size);
+       printf_verbose("Range max len: %lu.\n",
+               range_max_len);
        if (validate_lookup)
                printf_verbose("Validating lookups.\n");
        if (leak_detection)
This page took 0.023018 seconds and 4 git commands to generate.