}
-/* 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;
- /* 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;
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)
if (err != 0)
exit(1);
tot_writes += tot_nr_writes[i];
- rcu_gc_cleanup(i);
+ rcu_gc_clear_queue(i);
}
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,
}
-/* 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;
- /* 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;
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)
if (err != 0)
exit(1);
tot_writes += tot_nr_writes[i];
- rcu_gc_cleanup(i);
+ rcu_gc_clear_queue(i);
}
printf_verbose("total number of reads : %llu, writes %llu\n", tot_reads,