projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update runtests.sh
[urcu.git]
/
test_qsbr_gc.c
diff --git
a/test_qsbr_gc.c
b/test_qsbr_gc.c
index ccdf593290967dc2ec89c6ac87768616c5803c71..c5cb9b168a905206d9bd837c9e9edc471d456dbd 100644
(file)
--- a/
test_qsbr_gc.c
+++ b/
test_qsbr_gc.c
@@
-70,7
+70,7
@@
static unsigned long duration;
/* read-side C.S. duration, in loops */
static unsigned long rduration;
/* read-side C.S. duration, in loops */
static unsigned long rduration;
-static int reclaim_batch = 1;
+static
unsigned
int reclaim_batch = 1;
struct reclaim_queue {
void **queue; /* Beginning of queue */
struct reclaim_queue {
void **queue; /* Beginning of queue */
@@
-180,20
+180,11
@@
void *thr_reader(void *_count)
}
}
-/* Using per-thread queue */
-static void rcu_gc_reclaim(unsigned long wtidx, void *old)
+static void rcu_gc_clear_queue(unsigned long wtidx)
{
void **p;
{
void **p;
- /* Queue pointer */
- *pending_reclaims[wtidx].head = old;
- pending_reclaims[wtidx].head++;
-
- if (likely(pending_reclaims[wtidx].head - pending_reclaims[wtidx].queue
- < reclaim_batch))
- return;
-
- /* If queue is full, wait for Q.S and empty queue */
+ /* Wait for Q.S and empty queue */
synchronize_rcu();
for (p = pending_reclaims[wtidx].queue;
synchronize_rcu();
for (p = pending_reclaims[wtidx].queue;
@@
-206,21
+197,18
@@
static void rcu_gc_reclaim(unsigned long wtidx, void *old)
pending_reclaims[wtidx].head = pending_reclaims[wtidx].queue;
}
pending_reclaims[wtidx].head = pending_reclaims[wtidx].queue;
}
-static void rcu_gc_cleanup(unsigned long wtidx)
+/* Using per-thread queue */
+static void rcu_gc_reclaim(unsigned long wtidx, void *old)
{
{
- void **p;
+ /* Queue pointer */
+ *pending_reclaims[wtidx].head = old;
+ pending_reclaims[wtidx].head++;
- /* Wait for Q.S and empty queue */
- synchronize_rcu();
+ if (likely(pending_reclaims[wtidx].head - pending_reclaims[wtidx].queue
+ < reclaim_batch))
+ return;
- for (p = pending_reclaims[wtidx].queue;
- p < pending_reclaims[wtidx].head; p++) {
- /* poison */
- if (*p)
- ((struct test_array *)*p)->a = 0;
- free(*p);
- }
- pending_reclaims[wtidx].head = pending_reclaims[wtidx].queue;
+ rcu_gc_clear_queue(wtidx);
}
void *thr_writer(void *data)
}
void *thr_writer(void *data)
@@
-419,17
+407,18
@@
int main(int argc, char **argv)
if (err != 0)
exit(1);
tot_writes += tot_nr_writes[i];
if (err != 0)
exit(1);
tot_writes += tot_nr_writes[i];
- rcu_gc_clea
nup
(i);
+ rcu_gc_clea
r_queue
(i);
}
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu "
"nr_writers %3u "
}
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
tot_writes);
printf("SUMMARY %-25s testdur %4lu nr_readers %3u rdur %6lu "
"nr_writers %3u "
- "wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu\n",
+ "wdelay %6lu nr_reads %12llu nr_writes %12llu nr_ops %12llu "
+ "batch %u\n",
argv[0], duration, nr_readers, rduration,
nr_writers, wdelay, tot_reads, tot_writes,
argv[0], duration, nr_readers, rduration,
nr_writers, wdelay, tot_reads, tot_writes,
- tot_reads + tot_writes);
+ tot_reads + tot_writes
, reclaim_batch
);
free(tid_reader);
free(tid_writer);
free(count_reader);
free(tid_reader);
free(tid_writer);
free(count_reader);
This page took
0.024239 seconds
and
4
git commands to generate.