projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lfstack: implement test
[urcu.git]
/
tests
/
test_urcu_lfs.c
diff --git
a/tests/test_urcu_lfs.c
b/tests/test_urcu_lfs.c
index 61abaad4567cf2c79a080d98e5eec99947f2162b..9af846d1c782a724caeb41306e39aa29352ac0c4 100644
(file)
--- a/
tests/test_urcu_lfs.c
+++ b/
tests/test_urcu_lfs.c
@@
-1,9
+1,9
@@
/*
* test_urcu_lfs.c
*
/*
* test_urcu_lfs.c
*
- * Userspace RCU library - example
RCU-based
lock-free stack
+ * Userspace RCU library - example lock-free stack
*
*
- * Copyright
February 2010
- Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright
2010-2012
- Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
@@
-105,9
+105,10
@@
typedef unsigned long cpu_set_t;
static void set_affinity(void)
{
static void set_affinity(void)
{
+#if HAVE_SCHED_SETAFFINITY
cpu_set_t mask;
cpu_set_t mask;
- int cpu;
- int ret;
+ int cpu
, ret
;
+#endif /* HAVE_SCHED_SETAFFINITY */
if (!use_affinity)
return;
if (!use_affinity)
return;
@@
-158,11
+159,11
@@
static unsigned int nr_enqueuers;
static unsigned int nr_dequeuers;
struct test {
static unsigned int nr_dequeuers;
struct test {
- struct cds_lfs_node
_rcu
list;
+ struct cds_lfs_node list;
struct rcu_head rcu;
};
struct rcu_head rcu;
};
-static struct cds_lfs_stack
_rcu
s;
+static struct cds_lfs_stack s;
void *thr_enqueuer(void *_count)
{
void *thr_enqueuer(void *_count)
{
@@
-184,9
+185,8
@@
void *thr_enqueuer(void *_count)
struct test *node = malloc(sizeof(*node));
if (!node)
goto fail;
struct test *node = malloc(sizeof(*node));
if (!node)
goto fail;
- cds_lfs_node_init_rcu(&node->list);
- /* No rcu read-side is needed for push */
- cds_lfs_push_rcu(&s, &node->list);
+ cds_lfs_node_init(&node->list);
+ cds_lfs_push(&s, &node->list);
URCU_TLS(nr_successful_enqueues)++;
if (caa_unlikely(wdelay))
URCU_TLS(nr_successful_enqueues)++;
if (caa_unlikely(wdelay))
@@
-234,10
+234,10
@@
void *thr_dequeuer(void *_count)
cmm_smp_mb();
for (;;) {
cmm_smp_mb();
for (;;) {
- struct cds_lfs_node
_rcu
*snode;
+ struct cds_lfs_node *snode;
rcu_read_lock();
rcu_read_lock();
- snode = cds_lfs_pop
_rcu
(&s);
+ snode = cds_lfs_pop(&s);
rcu_read_unlock();
if (snode) {
struct test *node;
rcu_read_unlock();
if (snode) {
struct test *node;
@@
-264,12
+264,12
@@
void *thr_dequeuer(void *_count)
return ((void*)2);
}
return ((void*)2);
}
-void test_end(struct cds_lfs_stack
_rcu
*s, unsigned long long *nr_dequeues)
+void test_end(struct cds_lfs_stack *s, unsigned long long *nr_dequeues)
{
{
- struct cds_lfs_node
_rcu
*snode;
+ struct cds_lfs_node *snode;
do {
do {
- snode = cds_lfs_pop
_rcu
(s);
+ snode = cds_lfs_pop(s);
if (snode) {
struct test *node;
if (snode) {
struct test *node;
@@
-371,7
+371,7
@@
int main(int argc, char **argv)
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
- cds_lfs_init
_rcu
(&s);
+ cds_lfs_init(&s);
err = create_all_cpu_call_rcu_data(0);
if (err) {
printf("Per-CPU call_rcu() worker threads unavailable. Using default global worker thread.\n");
err = create_all_cpu_call_rcu_data(0);
if (err) {
printf("Per-CPU call_rcu() worker threads unavailable. Using default global worker thread.\n");
This page took
0.02555 seconds
and
4
git commands to generate.