rcuja tests: free node cb does not need to wait for Q.S. in destroy
[userspace-rcu.git] / rcuja / rcuja.c
index a608dd7c4797e534339f64ab841c054492f7e00e..81ec0a8577e8fd402c4c5368070b8ab0b93cbcfa 100644 (file)
@@ -1032,7 +1032,7 @@ unsigned int ja_node_sum_distribution_1d(enum ja_recompact mode,
        for (bit_i = 0; bit_i < JA_BITS_PER_BYTE; bit_i++) {
                unsigned int distance_to_best;
 
-               distance_to_best = abs_int((nr_one[bit_i] << 1U) - distrib_nr_child);
+               distance_to_best = abs_int(((unsigned int) nr_one[bit_i] << 1U) - distrib_nr_child);
                if (distance_to_best < overall_best_distance) {
                        overall_best_distance = distance_to_best;
                        bitsel = bit_i;
@@ -1228,10 +1228,10 @@ void ja_node_sum_distribution_2d(enum ja_recompact mode,
                for (bit_j = 0; bit_j < bit_i; bit_j++) {
                        int distance_to_best[4];
 
-                       distance_to_best[0] = (nr_2d_11[bit_i][bit_j] << 2U) - distrib_nr_child;
-                       distance_to_best[1] = (nr_2d_10[bit_i][bit_j] << 2U) - distrib_nr_child;
-                       distance_to_best[2] = (nr_2d_01[bit_i][bit_j] << 2U) - distrib_nr_child;
-                       distance_to_best[3] = (nr_2d_00[bit_i][bit_j] << 2U) - distrib_nr_child;
+                       distance_to_best[0] = ((unsigned int) nr_2d_11[bit_i][bit_j] << 2U) - distrib_nr_child;
+                       distance_to_best[1] = ((unsigned int) nr_2d_10[bit_i][bit_j] << 2U) - distrib_nr_child;
+                       distance_to_best[2] = ((unsigned int) nr_2d_01[bit_i][bit_j] << 2U) - distrib_nr_child;
+                       distance_to_best[3] = ((unsigned int) nr_2d_00[bit_i][bit_j] << 2U) - distrib_nr_child;
 
                        /* Consider worse distance above best */
                        if (distance_to_best[1] > 0 && distance_to_best[1] > distance_to_best[0])
@@ -2015,7 +2015,7 @@ end:
 
 static
 int _cds_ja_add(struct cds_ja *ja, uint64_t key,
-               struct cds_ja_node *new_node,
+               struct cds_ja_node *node,
                struct cds_ja_node **unique_node_ret)
 {
        unsigned int tree_depth, i;
@@ -2036,7 +2036,7 @@ int _cds_ja_add(struct cds_ja *ja, uint64_t key,
 
 retry:
        dbg_printf("cds_ja_add attempt: key %" PRIu64 ", node %p\n",
-               key, new_node);
+               key, node);
        parent2_node_flag = NULL;
        parent_node_flag =
                (struct cds_ja_inode_flag *) &ja->root; /* Use root ptr address as key for mutex */
@@ -2079,7 +2079,7 @@ retry:
                                parent_attach_node_flag,
                                node_flag_ptr,
                                node_flag,
-                               key, i, new_node);
+                               key, i, node);
        } else {
                if (unique_node_ret) {
                        *unique_node_ret = (struct cds_ja_node *) ja_node_ptr(node_flag);
@@ -2097,7 +2097,7 @@ retry:
                        parent_attach_node_flag,
                        attach_node_flag_ptr,
                        attach_node_flag,
-                       new_node);
+                       node);
        }
        if (ret == -EAGAIN || ret == -EEXIST)
                goto retry;
@@ -2106,22 +2106,22 @@ retry:
 }
 
 int cds_ja_add(struct cds_ja *ja, uint64_t key,
-               struct cds_ja_node *new_node)
+               struct cds_ja_node *node)
 {
-       return _cds_ja_add(ja, key, new_node, NULL);
+       return _cds_ja_add(ja, key, node, NULL);
 }
 
 struct cds_ja_node *cds_ja_add_unique(struct cds_ja *ja, uint64_t key,
-               struct cds_ja_node *new_node)
+               struct cds_ja_node *node)
 {
        int ret;
        struct cds_ja_node *ret_node;
 
-       ret = _cds_ja_add(ja, key, new_node, &ret_node);
+       ret = _cds_ja_add(ja, key, node, &ret_node);
        if (ret == -EEXIST)
                return ret_node;
        else
-               return new_node;
+               return node;
 }
 
 /*
@@ -2630,11 +2630,12 @@ int ja_final_checks(struct cds_ja *ja)
 }
 
 /*
- * There should be no more concurrent add to the judy array while it is
- * being destroyed (ensured by the caller).
+ * There should be no more concurrent add, delete, nor look-up performed
+ * on the Judy array while it is being destroyed (ensured by the
+ * caller).
  */
 int cds_ja_destroy(struct cds_ja *ja,
-               void (*rcu_free_node)(struct cds_ja_node *node))
+               void (*free_node_cb)(struct cds_ja_node *node))
 {
        const struct rcu_flavor_struct *flavor;
        int ret;
@@ -2642,7 +2643,7 @@ int cds_ja_destroy(struct cds_ja *ja,
        flavor = cds_lfht_rcu_flavor(ja->ht);
        rcuja_shadow_prune(ja->ht,
                RCUJA_SHADOW_CLEAR_FREE_NODE | RCUJA_SHADOW_CLEAR_FREE_LOCK,
-               rcu_free_node);
+               free_node_cb);
        flavor->thread_offline();
        ret = rcuja_delete_ht(ja->ht);
        if (ret)
This page took 0.026284 seconds and 4 git commands to generate.