projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
urcu-defer: handle malloc error value
[urcu.git]
/
urcu-qsbr.c
diff --git
a/urcu-qsbr.c
b/urcu-qsbr.c
index 2cf73d5d5be30f62771a62152623fb81b5798133..69effd5ad8b52e3be4ee263ede2cafe81816f38b 100644
(file)
--- a/
urcu-qsbr.c
+++ b/
urcu-qsbr.c
@@
-59,7
+59,7
@@
unsigned int yield_active;
unsigned int __thread rand_yield;
#endif
unsigned int __thread rand_yield;
#endif
-static LIST_HEAD(registry);
+static
CDS_
LIST_HEAD(registry);
static void mutex_lock(pthread_mutex_t *mutex)
{
static void mutex_lock(pthread_mutex_t *mutex)
{
@@
-108,17
+108,17
@@
static void wait_gp(void)
static void update_counter_and_wait(void)
{
static void update_counter_and_wait(void)
{
- LIST_HEAD(qsreaders);
+
CDS_
LIST_HEAD(qsreaders);
int wait_loops = 0;
struct rcu_reader *index, *tmp;
int wait_loops = 0;
struct rcu_reader *index, *tmp;
-#if (BITS_PER_LONG < 64)
+#if (
CAA_
BITS_PER_LONG < 64)
/* Switch parity: 0 -> 1, 1 -> 0 */
/* Switch parity: 0 -> 1, 1 -> 0 */
- STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR);
-#else /* !(BITS_PER_LONG < 64) */
+
CMM_
STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr ^ RCU_GP_CTR);
+#else /* !(
CAA_
BITS_PER_LONG < 64) */
/* Increment current G.P. */
/* Increment current G.P. */
- STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr + RCU_GP_CTR);
-#endif /* !(BITS_PER_LONG < 64) */
+
CMM_
STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr + RCU_GP_CTR);
+#endif /* !(
CAA_
BITS_PER_LONG < 64) */
/*
* Must commit rcu_gp_ctr update to memory before waiting for quiescent
/*
* Must commit rcu_gp_ctr update to memory before waiting for quiescent
@@
-146,12
+146,12
@@
static void update_counter_and_wait(void)
cmm_smp_mb();
}
cmm_smp_mb();
}
- list_for_each_entry_safe(index, tmp, ®istry, node) {
+
cds_
list_for_each_entry_safe(index, tmp, ®istry, node) {
if (!rcu_gp_ongoing(&index->ctr))
if (!rcu_gp_ongoing(&index->ctr))
- list_move(&index->node, &qsreaders);
+
cds_
list_move(&index->node, &qsreaders);
}
}
- if (list_empty(®istry)) {
+ if (
cds_
list_empty(®istry)) {
if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) {
/* Read reader_gp before write futex */
cmm_smp_mb();
if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) {
/* Read reader_gp before write futex */
cmm_smp_mb();
@@
-163,7
+163,7
@@
static void update_counter_and_wait(void)
wait_gp();
} else {
#ifndef HAS_INCOHERENT_CACHES
wait_gp();
} else {
#ifndef HAS_INCOHERENT_CACHES
- cpu_relax();
+ c
aa_c
pu_relax();
#else /* #ifndef HAS_INCOHERENT_CACHES */
cmm_smp_mb();
#endif /* #else #ifndef HAS_INCOHERENT_CACHES */
#else /* #ifndef HAS_INCOHERENT_CACHES */
cmm_smp_mb();
#endif /* #else #ifndef HAS_INCOHERENT_CACHES */
@@
-171,7
+171,7
@@
static void update_counter_and_wait(void)
}
}
/* put back the reader list in the registry */
}
}
/* put back the reader list in the registry */
- list_splice(&qsreaders, ®istry);
+
cds_
list_splice(&qsreaders, ®istry);
}
/*
}
/*
@@
-179,7
+179,7
@@
static void update_counter_and_wait(void)
* long-size to ensure we do not encounter an overflow bug.
*/
* long-size to ensure we do not encounter an overflow bug.
*/
-#if (BITS_PER_LONG < 64)
+#if (
CAA_
BITS_PER_LONG < 64)
void synchronize_rcu(void)
{
unsigned long was_online;
void synchronize_rcu(void)
{
unsigned long was_online;
@@
-198,11
+198,11
@@
void synchronize_rcu(void)
* threads registered as readers.
*/
if (was_online)
* threads registered as readers.
*/
if (was_online)
- STORE_SHARED(rcu_reader.ctr, 0);
+
CMM_
STORE_SHARED(rcu_reader.ctr, 0);
mutex_lock(&rcu_gp_lock);
mutex_lock(&rcu_gp_lock);
- if (list_empty(®istry))
+ if (
cds_
list_empty(®istry))
goto out;
/*
goto out;
/*
@@
-238,10
+238,10
@@
out:
* freed.
*/
if (was_online)
* freed.
*/
if (was_online)
- _
STORE_SHARED(rcu_reader.ctr,
LOAD_SHARED(rcu_gp_ctr));
+ _
CMM_STORE_SHARED(rcu_reader.ctr, CMM_
LOAD_SHARED(rcu_gp_ctr));
cmm_smp_mb();
}
cmm_smp_mb();
}
-#else /* !(BITS_PER_LONG < 64) */
+#else /* !(
CAA_
BITS_PER_LONG < 64) */
void synchronize_rcu(void)
{
unsigned long was_online;
void synchronize_rcu(void)
{
unsigned long was_online;
@@
-255,20
+255,20
@@
void synchronize_rcu(void)
*/
cmm_smp_mb();
if (was_online)
*/
cmm_smp_mb();
if (was_online)
- STORE_SHARED(rcu_reader.ctr, 0);
+
CMM_
STORE_SHARED(rcu_reader.ctr, 0);
mutex_lock(&rcu_gp_lock);
mutex_lock(&rcu_gp_lock);
- if (list_empty(®istry))
+ if (
cds_
list_empty(®istry))
goto out;
update_counter_and_wait();
out:
mutex_unlock(&rcu_gp_lock);
if (was_online)
goto out;
update_counter_and_wait();
out:
mutex_unlock(&rcu_gp_lock);
if (was_online)
- _
STORE_SHARED(rcu_reader.ctr,
LOAD_SHARED(rcu_gp_ctr));
+ _
CMM_STORE_SHARED(rcu_reader.ctr, CMM_
LOAD_SHARED(rcu_gp_ctr));
cmm_smp_mb();
}
cmm_smp_mb();
}
-#endif /* !(BITS_PER_LONG < 64) */
+#endif /* !(
CAA_
BITS_PER_LONG < 64) */
/*
* library wrappers to be used by non-LGPL compatible source code.
/*
* library wrappers to be used by non-LGPL compatible source code.
@@
-305,7
+305,7
@@
void rcu_register_thread(void)
assert(rcu_reader.ctr == 0);
mutex_lock(&rcu_gp_lock);
assert(rcu_reader.ctr == 0);
mutex_lock(&rcu_gp_lock);
- list_add(&rcu_reader.node, ®istry);
+
cds_
list_add(&rcu_reader.node, ®istry);
mutex_unlock(&rcu_gp_lock);
_rcu_thread_online();
}
mutex_unlock(&rcu_gp_lock);
_rcu_thread_online();
}
@@
-318,11
+318,11
@@
void rcu_unregister_thread(void)
*/
_rcu_thread_offline();
mutex_lock(&rcu_gp_lock);
*/
_rcu_thread_offline();
mutex_lock(&rcu_gp_lock);
- list_del(&rcu_reader.node);
+
cds_
list_del(&rcu_reader.node);
mutex_unlock(&rcu_gp_lock);
}
void rcu_exit(void)
{
mutex_unlock(&rcu_gp_lock);
}
void rcu_exit(void)
{
- assert(list_empty(®istry));
+ assert(
cds_
list_empty(®istry));
}
}
This page took
0.030889 seconds
and
4
git commands to generate.