- switch (nr_cpus_mask) {
- case -2:
- return NULL;
- case -1:
- {
- long maxcpus;
-
- maxcpus = sysconf(_SC_NPROCESSORS_CONF);
- if (maxcpus <= 0) {
- nr_cpus_mask = -2;
- return NULL;
- }
- /*
- * round up number of CPUs to next power of two, so we
- * can use & for modulo.
- */
- maxcpus = 1UL << get_count_order_ulong(maxcpus);
- nr_cpus_mask = maxcpus - 1;
- }
- /* Fall-through */
- default:
- return calloc(nr_cpus_mask + 1, sizeof(*count));
+ if (nr_cpus_mask == -1) {
+ ht_init_nr_cpus_mask();
+ split_count_mask = nr_cpus_mask;