projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: sysconf(_SC_NPROCESSORS_CONF) can be less than max cpu id
[userspace-rcu.git]
/
src
/
rculfhash.c
diff --git
a/src/rculfhash.c
b/src/rculfhash.c
index 04fd49946aa940184015a4921971feff5d3818e5..7c0b9fb8081fbfd4db089def5665d01d7b6cda90 100644
(file)
--- a/
src/rculfhash.c
+++ b/
src/rculfhash.c
@@
-281,6
+281,7
@@
#include "workqueue.h"
#include "urcu-die.h"
#include "urcu-utils.h"
#include "workqueue.h"
#include "urcu-die.h"
#include "urcu-utils.h"
+#include "compat-smp.h"
/*
* Split-counters lazily update the global counter each 1024
/*
* Split-counters lazily update the global counter each 1024
@@
-645,12
+646,11
@@
static long nr_cpus_mask = -1;
static long split_count_mask = -1;
static int split_count_order = -1;
static long split_count_mask = -1;
static int split_count_order = -1;
-#if defined(HAVE_SYSCONF)
static void ht_init_nr_cpus_mask(void)
{
long maxcpus;
static void ht_init_nr_cpus_mask(void)
{
long maxcpus;
- maxcpus =
sysconf(_SC_NPROCESSORS_CONF
);
+ maxcpus =
get_possible_cpus_array_len(
);
if (maxcpus <= 0) {
nr_cpus_mask = -2;
return;
if (maxcpus <= 0) {
nr_cpus_mask = -2;
return;
@@
-662,12
+662,6
@@
static void ht_init_nr_cpus_mask(void)
maxcpus = 1UL << cds_lfht_get_count_order_ulong(maxcpus);
nr_cpus_mask = maxcpus - 1;
}
maxcpus = 1UL << cds_lfht_get_count_order_ulong(maxcpus);
nr_cpus_mask = maxcpus - 1;
}
-#else /* #if defined(HAVE_SYSCONF) */
-static void ht_init_nr_cpus_mask(void)
-{
- nr_cpus_mask = -2;
-}
-#endif /* #else #if defined(HAVE_SYSCONF) */
static
void alloc_split_items_count(struct cds_lfht *ht)
static
void alloc_split_items_count(struct cds_lfht *ht)
@@
-763,7
+757,7
@@
void ht_count_del(struct cds_lfht *ht, unsigned long size, unsigned long hash)
if ((count >> CHAIN_LEN_RESIZE_THRESHOLD) >= size)
return;
if ((count >> CHAIN_LEN_RESIZE_THRESHOLD) >= size)
return;
- dbg_printf("del set global %l
d
\n", count);
+ dbg_printf("del set global %l
u
\n", count);
/*
* Don't shrink table if the number of nodes is below a
* certain threshold.
/*
* Don't shrink table if the number of nodes is below a
* certain threshold.
@@
-851,6
+845,12
@@
int is_removal_owner(struct cds_lfht_node *node)
return ((unsigned long) node) & REMOVAL_OWNER_FLAG;
}
return ((unsigned long) node) & REMOVAL_OWNER_FLAG;
}
+static
+struct cds_lfht_node *flag_removed(struct cds_lfht_node *node)
+{
+ return (struct cds_lfht_node *) (((unsigned long) node) | REMOVED_FLAG);
+}
+
static
struct cds_lfht_node *flag_removal_owner(struct cds_lfht_node *node)
{
static
struct cds_lfht_node *flag_removal_owner(struct cds_lfht_node *node)
{
@@
-1578,6
+1578,12
@@
const struct cds_lfht_mm_type *get_mm_type(
}
#endif
}
#endif
+void cds_lfht_node_init_deleted(struct cds_lfht_node *node)
+{
+ cds_lfht_node_init(node);
+ node->next = flag_removed(NULL);
+}
+
struct cds_lfht *_cds_lfht_new(unsigned long init_size,
unsigned long min_nr_alloc_buckets,
unsigned long max_nr_buckets,
struct cds_lfht *_cds_lfht_new(unsigned long init_size,
unsigned long min_nr_alloc_buckets,
unsigned long max_nr_buckets,
This page took
0.024626 seconds
and
4
git commands to generate.