projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Maintain list of struct call_rcu_data to keep valgrind happy.
[userspace-rcu.git]
/
urcu-call-rcu.c
diff --git
a/urcu-call-rcu.c
b/urcu-call-rcu.c
index 5c003aa944e9606ca8e2d27d4572bcefd186f0a8..aa1324e00568ef40b081ea2a7441603dd6270649 100644
(file)
--- a/
urcu-call-rcu.c
+++ b/
urcu-call-rcu.c
@@
-36,6
+36,7
@@
#include "urcu/wfqueue.h"
#include "urcu-call-rcu.h"
#include "urcu-pointer.h"
#include "urcu/wfqueue.h"
#include "urcu-call-rcu.h"
#include "urcu-pointer.h"
+#include "urcu/list.h"
/* Data structure that identifies a call_rcu thread. */
/* Data structure that identifies a call_rcu thread. */
@@
-46,8
+47,16
@@
struct call_rcu_data {
pthread_cond_t cond;
unsigned long qlen;
pthread_t tid;
pthread_cond_t cond;
unsigned long qlen;
pthread_t tid;
+ struct cds_list_head list;
} __attribute__((aligned(CAA_CACHE_LINE_SIZE)));
} __attribute__((aligned(CAA_CACHE_LINE_SIZE)));
+/*
+ * List of all call_rcu_data structures to keep valgrind happy.
+ * Protected by call_rcu_mutex.
+ */
+
+CDS_LIST_HEAD(call_rcu_data_list);
+
/* Link a thread using call_rcu() to its call_rcu thread. */
static __thread struct call_rcu_data *thread_call_rcu_data;
/* Link a thread using call_rcu() to its call_rcu thread. */
static __thread struct call_rcu_data *thread_call_rcu_data;
@@
-197,10
+206,12
@@
static void *call_rcu_thread(void *arg)
/*
* Create both a call_rcu thread and the corresponding call_rcu_data
/*
* Create both a call_rcu thread and the corresponding call_rcu_data
- * structure, linking the structure in as specified.
+ * structure, linking the structure in as specified. Caller must hold
+ * call_rcu_mutex.
*/
*/
-void call_rcu_data_init(struct call_rcu_data **crdpp, unsigned long flags)
+static void call_rcu_data_init(struct call_rcu_data **crdpp,
+ unsigned long flags)
{
struct call_rcu_data *crdp;
{
struct call_rcu_data *crdp;
@@
-221,6
+232,7
@@
void call_rcu_data_init(struct call_rcu_data **crdpp, unsigned long flags)
exit(-1);
}
crdp->flags = flags | URCU_CALL_RCU_RUNNING;
exit(-1);
}
crdp->flags = flags | URCU_CALL_RCU_RUNNING;
+ cds_list_add(&crdp->list, &call_rcu_data_list);
cmm_smp_mb(); /* Structure initialized before pointer is planted. */
*crdpp = crdp;
if (pthread_create(&crdp->tid, NULL, call_rcu_thread, crdp) != 0) {
cmm_smp_mb(); /* Structure initialized before pointer is planted. */
*crdpp = crdp;
if (pthread_create(&crdp->tid, NULL, call_rcu_thread, crdp) != 0) {
@@
-265,7
+277,7
@@
pthread_t get_call_rcu_thread(struct call_rcu_data *crdp)
* Create a call_rcu_data structure (with thread) and return a pointer.
*/
* Create a call_rcu_data structure (with thread) and return a pointer.
*/
-st
ruct call_rcu_data *
create_call_rcu_data(unsigned long flags)
+st
atic struct call_rcu_data *__
create_call_rcu_data(unsigned long flags)
{
struct call_rcu_data *crdp;
{
struct call_rcu_data *crdp;
@@
-273,6
+285,16
@@
struct call_rcu_data *create_call_rcu_data(unsigned long flags)
return crdp;
}
return crdp;
}
+struct call_rcu_data *create_call_rcu_data(unsigned long flags)
+{
+ struct call_rcu_data *crdp;
+
+ call_rcu_lock(&call_rcu_mutex);
+ crdp = __create_call_rcu_data(flags);
+ call_rcu_unlock(&call_rcu_mutex);
+ return crdp;
+}
+
/*
* Set the specified CPU to use the specified call_rcu_data structure.
*/
/*
* Set the specified CPU to use the specified call_rcu_data structure.
*/
@@
-399,7
+421,7
@@
int create_all_cpu_call_rcu_data(unsigned long flags)
call_rcu_unlock(&call_rcu_mutex);
continue;
}
call_rcu_unlock(&call_rcu_mutex);
continue;
}
- crdp = create_call_rcu_data(flags);
+ crdp =
__
create_call_rcu_data(flags);
if (crdp == NULL) {
call_rcu_unlock(&call_rcu_mutex);
errno = ENOMEM;
if (crdp == NULL) {
call_rcu_unlock(&call_rcu_mutex);
errno = ENOMEM;
This page took
0.022951 seconds
and
4
git commands to generate.