#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
+#ifdef __linux__
+#include <syscall.h>
+#endif
+
/* hardcoded number of CPUs */
#define NR_CPUS 16384
static inline void loop_sleep(unsigned long l)
{
while(l-- != 0)
- cpu_relax();
+ caa_cpu_relax();
}
static int verbose_mode;
static unsigned long long __thread nr_reads;
static
-unsigned long long __attribute__((aligned(CACHE_LINE_SIZE))) *tot_nr_writes;
+unsigned long long __attribute__((aligned(CAA_CACHE_LINE_SIZE))) *tot_nr_writes;
static unsigned int nr_readers;
static unsigned int nr_writers;
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++;
- if (unlikely(!test_duration_read()))
+ if (caa_unlikely(!test_duration_read()))
break;
}
*pending_reclaims[wtidx].head = old;
pending_reclaims[wtidx].head++;
- if (likely(pending_reclaims[wtidx].head - pending_reclaims[wtidx].queue
+ if (caa_likely(pending_reclaims[wtidx].head - pending_reclaims[wtidx].queue
< reclaim_batch))
return;
new->a = 8;
old = rcu_xchg_pointer(&test_rcu_pointer, new);
#endif
- if (unlikely(wduration))
+ if (caa_unlikely(wduration))
loop_sleep(wduration);
rcu_gc_reclaim(wtidx, old);
nr_writes++;
- if (unlikely(!test_duration_write()))
+ if (caa_unlikely(!test_duration_write()))
break;
- if (unlikely(wdelay))
+ if (caa_unlikely(wdelay))
loop_sleep(wdelay);
}
tot_nr_writes = malloc(sizeof(*tot_nr_writes) * nr_writers);
pending_reclaims = malloc(sizeof(*pending_reclaims) * nr_writers);
if (reclaim_batch * sizeof(*pending_reclaims[i].queue)
- < CACHE_LINE_SIZE)
+ < CAA_CACHE_LINE_SIZE)
for (i = 0; i < nr_writers; i++)
- pending_reclaims[i].queue = calloc(1, CACHE_LINE_SIZE);
+ pending_reclaims[i].queue = calloc(1, CAA_CACHE_LINE_SIZE);
else
for (i = 0; i < nr_writers; i++)
pending_reclaims[i].queue = calloc(reclaim_batch,