X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=rculfhash.c;h=cd25d336aea3ef781456c046699ef86e2de81b92;hb=d933dd0e116eceb59b1df0f223e3962a1e51bfb3;hp=9a95be260783e66aea715fa3806f0e5f0571e66f;hpb=e3ecefd6319001d15f8abc05f28fce0feb5c82bb;p=urcu.git diff --git a/rculfhash.c b/rculfhash.c index 9a95be2..cd25d33 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -246,7 +246,7 @@ struct cds_lfht { void (*cds_lfht_rcu_register_thread)(void); void (*cds_lfht_rcu_unregister_thread)(void); pthread_attr_t *resize_attr; /* Resize threads attributes */ - unsigned long count; /* global approximate item count */ + long count; /* global approximate item count */ struct ht_items_count *percpu_count; /* per-cpu item count */ }; @@ -566,12 +566,6 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size) if ((count >> CHAIN_LEN_RESIZE_THRESHOLD) < size) return; dbg_printf("add set global %ld\n", count); - /* - * Don't resize table if the number of nodes is below a - * certain threshold. - */ - if (count < (1UL << COUNT_COMMIT_ORDER)) - return; cds_lfht_resize_lazy_count(ht, size, count >> (CHAIN_LEN_TARGET - 1)); } @@ -602,10 +596,10 @@ void ht_count_del(struct cds_lfht *ht, unsigned long size) return; dbg_printf("del set global %ld\n", count); /* - * Don't resize table if the number of nodes is below a + * Don't shrink table if the number of nodes is below a * certain threshold. */ - if (count < (1UL << COUNT_COMMIT_ORDER)) + if (count < (1UL << COUNT_COMMIT_ORDER) * (nr_cpus_mask + 1)) return; cds_lfht_resize_lazy_count(ht, size, count >> (CHAIN_LEN_TARGET - 1)); @@ -1458,10 +1452,10 @@ int cds_lfht_destroy(struct cds_lfht *ht, pthread_attr_t **attr) } void cds_lfht_count_nodes(struct cds_lfht *ht, - unsigned long *approx_before, + long *approx_before, unsigned long *count, unsigned long *removed, - unsigned long *approx_after) + long *approx_after) { struct cds_lfht_node *node, *next; struct _cds_lfht_node *lookup;