projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rculfhash: Move key out of struct lfht_test_node, move key_len to caller
[urcu.git]
/
tests
/
test_urcu_assign.c
diff --git
a/tests/test_urcu_assign.c
b/tests/test_urcu_assign.c
index 851b8506b9bc85791b77fb5fad12fdc88ea8508c..42d70c26ce8b15ef0ae074e83ca3c9632bc0dc00 100644
(file)
--- a/
tests/test_urcu_assign.c
+++ b/
tests/test_urcu_assign.c
@@
-186,7
+186,8
@@
void rcu_copy_mutex_unlock(void)
/*
* malloc/free are reusing memory areas too quickly, which does not let us
* test races appropriately. Use a large circular array for allocations.
/*
* malloc/free are reusing memory areas too quickly, which does not let us
* test races appropriately. Use a large circular array for allocations.
- * ARRAY_SIZE is larger than nr_writers, which insures we never run over our tail.
+ * ARRAY_SIZE is larger than nr_writers, and we keep the mutex across
+ * both alloc and free, which insures we never run over our tail.
*/
#define ARRAY_SIZE (1048576 * nr_writers)
#define ARRAY_POISON 0xDEADBEEF
*/
#define ARRAY_SIZE (1048576 * nr_writers)
#define ARRAY_POISON 0xDEADBEEF
@@
-198,7
+199,6
@@
static struct test_array *test_array_alloc(void)
struct test_array *ret;
int index;
struct test_array *ret;
int index;
- rcu_copy_mutex_lock();
index = array_index % ARRAY_SIZE;
assert(test_array[index].a == ARRAY_POISON ||
test_array[index].a == 0);
index = array_index % ARRAY_SIZE;
assert(test_array[index].a == ARRAY_POISON ||
test_array[index].a == 0);
@@
-206,7
+206,6
@@
static struct test_array *test_array_alloc(void)
array_index++;
if (array_index == ARRAY_SIZE)
array_index = 0;
array_index++;
if (array_index == ARRAY_SIZE)
array_index = 0;
- rcu_copy_mutex_unlock();
return ret;
}
return ret;
}
@@
-214,9
+213,7
@@
static void test_array_free(struct test_array *ptr)
{
if (!ptr)
return;
{
if (!ptr)
return;
- rcu_copy_mutex_lock();
ptr->a = ARRAY_POISON;
ptr->a = ARRAY_POISON;
- rcu_copy_mutex_unlock();
}
void *thr_reader(void *_count)
}
void *thr_reader(void *_count)
@@
-242,11
+239,11
@@
void *thr_reader(void *_count)
debug_yield_read();
if (local_ptr)
assert(local_ptr->a == 8);
debug_yield_read();
if (local_ptr)
assert(local_ptr->a == 8);
- if (unlikely(rduration))
+ if (
caa_
unlikely(rduration))
loop_sleep(rduration);
rcu_read_unlock();
nr_reads++;
loop_sleep(rduration);
rcu_read_unlock();
nr_reads++;
- if (unlikely(!test_duration_read()))
+ if (
caa_
unlikely(!test_duration_read()))
break;
}
break;
}
@@
-275,22
+272,22
@@
void *thr_writer(void *_count)
cmm_smp_mb();
for (;;) {
cmm_smp_mb();
for (;;) {
+ rcu_copy_mutex_lock();
new = test_array_alloc();
new->a = 8;
new = test_array_alloc();
new->a = 8;
- rcu_copy_mutex_lock();
old = test_rcu_pointer;
rcu_assign_pointer(test_rcu_pointer, new);
old = test_rcu_pointer;
rcu_assign_pointer(test_rcu_pointer, new);
- if (unlikely(wduration))
+ if (
caa_
unlikely(wduration))
loop_sleep(wduration);
loop_sleep(wduration);
- rcu_copy_mutex_unlock();
synchronize_rcu();
if (old)
old->a = 0;
test_array_free(old);
synchronize_rcu();
if (old)
old->a = 0;
test_array_free(old);
+ rcu_copy_mutex_unlock();
nr_writes++;
nr_writes++;
- if (unlikely(!test_duration_write()))
+ if (
caa_
unlikely(!test_duration_write()))
break;
break;
- if (unlikely(wdelay))
+ if (
caa_
unlikely(wdelay))
loop_sleep(wdelay);
}
loop_sleep(wdelay);
}
This page took
0.024604 seconds
and
4
git commands to generate.