Commit 918b351d authored by Paul E. McKenney's avatar Paul E. McKenney

refperf: Change readdelay module parameter to nanoseconds

The current units of microseconds are too coarse, so this commit
changes the units to nanoseconds.  However, ndelay is used only for the
nanoseconds with udelay being used for whole microseconds.  For example,
setting refperf.readdelay=1500 results in a udelay(1) followed by an
ndelay(500).
Suggested-by: default avatarAkira Yokosawa <akiyks@gmail.com>
[ paulmck: Abstracted delay per Akira feedback and move from 80 to 100 lines. ]
[ paulmck: Fix names as suggested by kbuild test robot. ]
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 7c944d7c
......@@ -66,8 +66,8 @@ torture_param(long, loops, 10000, "Number of loops per experiment.");
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
......@@ -111,12 +111,20 @@ struct ref_perf_ops {
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;
......@@ -127,13 +135,13 @@ static void ref_rcu_read_section(const int nloops)
}
}
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();
}
}
......@@ -165,14 +173,14 @@ static void srcu_ref_perf_read_section(const int nloops)
}
}
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);
}
}
......@@ -197,13 +205,13 @@ static void ref_refcnt_section(const int nloops)
}
}
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);
}
}
......@@ -233,13 +241,13 @@ static void ref_rwlock_section(const int nloops)
}
}
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);
}
}
......@@ -269,13 +277,13 @@ static void ref_rwsem_section(const int nloops)
}
}
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);
}
}
......@@ -292,7 +300,7 @@ static void rcu_perf_one_reader(void)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment