Commit b864f89f authored by Paul E. McKenney's avatar Paul E. McKenney

refperf: Tune reader measurement interval

This commit moves a printk() out of the measurement interval, converts
a atomic_dec()/atomic_read() pair to atomic_dec_and_test(), and adds
a smp_mb__before_atomic() to avoid potential wake/wait hangs.  These
changes have the added benefit of reducing the number of loops required
for amortizing loop overhead for CONFIG_PREEMPT=n RCU measurements from
1,000,000 to 10,000.  This reduction in turn shortens the test, reducing
the probability of interference.

Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 2990750b
...@@ -252,15 +252,16 @@ ref_perf_reader(void *arg) ...@@ -252,15 +252,16 @@ ref_perf_reader(void *arg)
// Make sure that the CPU is affinitized appropriately during testing. // Make sure that the CPU is affinitized appropriately during testing.
WARN_ON_ONCE(smp_processor_id() != me); WARN_ON_ONCE(smp_processor_id() != me);
smp_mb__before_atomic();
atomic_dec(&rt->start); atomic_dec(&rt->start);
VERBOSE_PERFOUT("ref_perf_reader %ld: experiment %d started", me, exp_idx);
// To prevent noise, keep interrupts disabled. This also has the // To prevent noise, keep interrupts disabled. This also has the
// effect of preventing entries into slow path for rcu_read_unlock(). // effect of preventing entries into slow path for rcu_read_unlock().
local_irq_save(flags); local_irq_save(flags);
start = ktime_get_mono_fast_ns(); start = ktime_get_mono_fast_ns();
VERBOSE_PERFOUT("ref_perf_reader %ld: experiment %d started", me, exp_idx);
cur_ops->readsection(loops); cur_ops->readsection(loops);
duration = ktime_get_mono_fast_ns() - start; duration = ktime_get_mono_fast_ns() - start;
...@@ -268,14 +269,12 @@ ref_perf_reader(void *arg) ...@@ -268,14 +269,12 @@ ref_perf_reader(void *arg)
rt->last_duration_ns = WARN_ON_ONCE(duration < 0) ? 0 : duration; rt->last_duration_ns = WARN_ON_ONCE(duration < 0) ? 0 : duration;
atomic_dec(&nreaders_exp); if (atomic_dec_and_test(&nreaders_exp))
wake_up(&main_wq);
VERBOSE_PERFOUT("ref_perf_reader %ld: experiment %d ended, (readers remaining=%d)", VERBOSE_PERFOUT("ref_perf_reader %ld: experiment %d ended, (readers remaining=%d)",
me, exp_idx, atomic_read(&nreaders_exp)); me, exp_idx, atomic_read(&nreaders_exp));
if (!atomic_read(&nreaders_exp))
wake_up(&main_wq);
if (!torture_must_stop()) if (!torture_must_stop())
goto repeat; goto repeat;
end: end:
......
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