X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=rculfhash.c;h=e17fd42778ca5c5f9d2967aabcca08c10991776b;hb=2819ef641bb6e2f7aa60c28f3a8f5ad252aa7d00;hp=ea65611266afac9aa0d99a7357b4beb0cfcfed50;hpb=ccdbf780e4c751ac1763eeb82b50ff98e0dd33d0;p=userspace-rcu.git diff --git a/rculfhash.c b/rculfhash.c index ea65611..e17fd42 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -1175,6 +1175,10 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i, int thread, ret; unsigned long nr_threads; + assert(nr_cpus_mask != -1); + if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) + goto fallback; + /* * Note: nr_cpus_mask + 1 is always power of 2. * We spawn just the number of threads we need to satisfy the minimum @@ -1267,13 +1271,6 @@ static void init_table_populate(struct cds_lfht *ht, unsigned long i, unsigned long len) { - assert(nr_cpus_mask != -1); - if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) { - ht->flavor->thread_online(); - init_table_populate_partition(ht, i, 0, len); - ht->flavor->thread_offline(); - return; - } partition_resize_helper(ht, i, len, init_table_populate_partition); } @@ -1366,14 +1363,6 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i, static void remove_table(struct cds_lfht *ht, unsigned long i, unsigned long len) { - - assert(nr_cpus_mask != -1); - if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) { - ht->flavor->thread_online(); - remove_table_partition(ht, i, 0, len); - ht->flavor->thread_offline(); - return; - } partition_resize_helper(ht, i, len, remove_table_partition); } @@ -1396,7 +1385,7 @@ void fini_table(struct cds_lfht *ht, unsigned long len; len = 1UL << (i - 1); - dbg_printf("fini order %lu len: %lu\n", i, len); + dbg_printf("fini order %ld len: %lu\n", i, len); /* Stop shrink if the resize target changes under us */ if (CMM_LOAD_SHARED(ht->resize_target) > (1UL << (i - 1)))