torture_param(int, nreaders, -1, "Number of readers, -1 for 75% of CPUs.");
// Number of runs.
torture_param(int, nruns, 30, "Number of experiments to run.");
-// Reader delay in microseconds, 0 for no delay.
-torture_param(int, readdelay, 0, "Read-side delay in microseconds.");
+// Reader delay in nanoseconds, 0 for no delay.
+torture_param(int, readdelay, 0, "Read-side delay in nanoseconds.");
#ifdef MODULE
# define REFPERF_SHUTDOWN 0
void (*init)(void);
void (*cleanup)(void);
void (*readsection)(const int nloops);
- void (*delaysection)(const int nloops, const int ndelay);
+ void (*delaysection)(const int nloops, const int udl, const int ndl);
const char *name;
};
static struct ref_perf_ops *cur_ops;
+static void un_delay(const int udl, const int ndl)
+{
+ if (udl)
+ udelay(udl);
+ if (ndl)
+ ndelay(ndl);
+}
+
static void ref_rcu_read_section(const int nloops)
{
int i;
}
}
-static void ref_rcu_delay_section(const int nloops, const int ndelay)
+static void ref_rcu_delay_section(const int nloops, const int udl, const int ndl)
{
int i;
for (i = nloops; i >= 0; i--) {
rcu_read_lock();
- udelay(ndelay);
+ un_delay(udl, ndl);
rcu_read_unlock();
}
}
}
}
-static void srcu_ref_perf_delay_section(const int nloops, const int ndelay)
+static void srcu_ref_perf_delay_section(const int nloops, const int udl, const int ndl)
{
int i;
int idx;
for (i = nloops; i >= 0; i--) {
idx = srcu_read_lock(srcu_ctlp);
- udelay(ndelay);
+ un_delay(udl, ndl);
srcu_read_unlock(srcu_ctlp, idx);
}
}
}
}
-static void ref_refcnt_delay_section(const int nloops, const int ndelay)
+static void ref_refcnt_delay_section(const int nloops, const int udl, const int ndl)
{
int i;
for (i = nloops; i >= 0; i--) {
atomic_inc(&refcnt);
- udelay(ndelay);
+ un_delay(udl, ndl);
atomic_dec(&refcnt);
}
}
}
}
-static void ref_rwlock_delay_section(const int nloops, const int ndelay)
+static void ref_rwlock_delay_section(const int nloops, const int udl, const int ndl)
{
int i;
for (i = nloops; i >= 0; i--) {
read_lock(&test_rwlock);
- udelay(ndelay);
+ un_delay(udl, ndl);
read_unlock(&test_rwlock);
}
}
}
}
-static void ref_rwsem_delay_section(const int nloops, const int ndelay)
+static void ref_rwsem_delay_section(const int nloops, const int udl, const int ndl)
{
int i;
for (i = nloops; i >= 0; i--) {
down_read(&test_rwsem);
- udelay(ndelay);
+ un_delay(udl, ndl);
up_read(&test_rwsem);
}
}
if (readdelay <= 0)
cur_ops->readsection(loops);
else
- cur_ops->delaysection(loops, readdelay);
+ cur_ops->delaysection(loops, readdelay / 1000, readdelay % 1000);
}
// Reader kthread. Repeatedly does empty RCU read-side