projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update x86 atomic, add test atomic
[userspace-rcu.git]
/
urcu-qsbr-static.h
diff --git
a/urcu-qsbr-static.h
b/urcu-qsbr-static.h
index b18affeb1be6ea203b7636e5f235011cd01580b7..22a93b2fd7a823d21c76cbbd1ad5c6bf3b0495e4 100644
(file)
--- a/
urcu-qsbr-static.h
+++ b/
urcu-qsbr-static.h
@@
-32,6
+32,7
@@
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
+#include <limits.h>
#include <compiler.h>
#include <arch.h>
#include <compiler.h>
#include <arch.h>
@@
-160,28
+161,43
@@
static inline void reader_barrier()
smp_mb();
}
smp_mb();
}
+#define RCU_GP_ONLINE (1UL << 0)
+#define RCU_GP_CTR (1UL << 1)
+
/*
* Global quiescent period counter with low-order bits unused.
* Using a int rather than a char to eliminate false register dependencies
* causing stalls on some architectures.
*/
/*
* Global quiescent period counter with low-order bits unused.
* Using a int rather than a char to eliminate false register dependencies
* causing stalls on some architectures.
*/
-extern long urcu_gp_ctr;
+extern unsigned long urcu_gp_ctr;
+
+extern unsigned long __thread rcu_reader_qs_gp;
-extern long __thread rcu_reader_qs_gp;
+#if (BITS_PER_LONG < 64)
+static inline int rcu_gp_ongoing(unsigned long *value)
+{
+ unsigned long reader_gp;
-static inline int rcu_gp_ongoing(long *value)
+ if (value == NULL)
+ return 0;
+ reader_gp = LOAD_SHARED(*value);
+ return reader_gp && ((reader_gp ^ urcu_gp_ctr) & RCU_GP_CTR);
+}
+#else /* !(BITS_PER_LONG < 64) */
+static inline int rcu_gp_ongoing(unsigned long *value)
{
{
- long reader_gp;
+
unsigned
long reader_gp;
if (value == NULL)
return 0;
reader_gp = LOAD_SHARED(*value);
if (value == NULL)
return 0;
reader_gp = LOAD_SHARED(*value);
- return
(reader_gp & 1) && (reader_gp - urcu_gp_ctr < 0
);
+ return
reader_gp && (reader_gp - urcu_gp_ctr > ULONG_MAX / 2
);
}
}
+#endif /* !(BITS_PER_LONG < 64) */
static inline void _rcu_read_lock(void)
{
static inline void _rcu_read_lock(void)
{
- rcu_assert(rcu_reader_qs_gp
& 1
);
+ rcu_assert(rcu_reader_qs_gp);
}
static inline void _rcu_read_unlock(void)
}
static inline void _rcu_read_unlock(void)
@@
-191,7
+207,7
@@
static inline void _rcu_read_unlock(void)
static inline void _rcu_quiescent_state(void)
{
smp_mb();
static inline void _rcu_quiescent_state(void)
{
smp_mb();
- _STORE_SHARED(rcu_reader_qs_gp, _LOAD_SHARED(urcu_gp_ctr)
+ 1
);
+ _STORE_SHARED(rcu_reader_qs_gp, _LOAD_SHARED(urcu_gp_ctr));
smp_mb();
}
smp_mb();
}
@@
-203,7
+219,7
@@
static inline void _rcu_thread_offline(void)
static inline void _rcu_thread_online(void)
{
static inline void _rcu_thread_online(void)
{
- _STORE_SHARED(rcu_reader_qs_gp, LOAD_SHARED(urcu_gp_ctr)
+ 1
);
+ _STORE_SHARED(rcu_reader_qs_gp, LOAD_SHARED(urcu_gp_ctr));
smp_mb();
}
smp_mb();
}
This page took
0.024345 seconds
and
4
git commands to generate.