History

refperf: Add warmup and cooldown processing phases

This commit causes all the readers to start running unmeasured load until all readers have done at least one such run (thus having warmed up), then run the measured load, and then run unmeasured load until all readers have completed their measured load. This approach avoids any thread running measured load while other readers are idle.

Paul E. McKenney committed 6 years ago

Commit 2db0bda1 parent 86e0da21 file · +18 −2Browse files

Unified · Split

kernel/rcu/refperf.c+18−2
@@ -100,6 +100,8 @@ static atomic_t nreaders_exp; · 99 unmodified lines
100100 // Use to wait for all threads to start.
101101 static atomic_t n_init;
102102 static atomic_t n_started;
103+static atomic_t n_warmedup;
104+static atomic_t n_cooleddown;
103105
104106 // Track which experiment is currently running.
105107 static int exp_idx;
@@ -260,8 +262,15 @@ repeat: · 154 unmodified lines
260262
261263 VERBOSE_PERFOUT("ref_perf_reader %ld: experiment %d started", me, exp_idx);
262264
263− // To prevent noise, keep interrupts disabled. This also has the
264− // effect of preventing entries into slow path for rcu_read_unlock().
265+
266+ // To reduce noise, do an initial cache-warming invocation, check
267+ // in, and then keep warming until everyone has checked in.
268+ cur_ops->readsection(loops);
269+ if (!atomic_dec_return(&n_warmedup))
270+ while (atomic_read_acquire(&n_warmedup))
271+ cur_ops->readsection(loops);
272+ // Also keep interrupts disabled. This also has the effect
273+ // of preventing entries into slow path for rcu_read_unlock().
265274 local_irq_save(flags);
266275 start = ktime_get_mono_fast_ns();
267276
@@ -271,6 +280,11 @@ repeat: · 3 unmodified lines
271280 local_irq_restore(flags);
272281
273282 rt->last_duration_ns = WARN_ON_ONCE(duration < 0) ? 0 : duration;
283+ // To reduce runtime-skew noise, do maintain-load invocations until
284+ // everyone is done.
285+ if (!atomic_dec_return(&n_cooleddown))
286+ while (atomic_read_acquire(&n_cooleddown))
287+ cur_ops->readsection(loops);
274288
275289 if (atomic_dec_and_test(&nreaders_exp))
276290 wake_up(&main_wq);
@@ -372,6 +386,8 @@ static int main_func(void *arg) · 95 unmodified lines
372386 reset_readers();
373387 atomic_set(&nreaders_exp, nreaders);
374388 atomic_set(&n_started, nreaders);
389+ atomic_set(&n_warmedup, nreaders);
390+ atomic_set(&n_cooleddown, nreaders);
375391
376392 exp_idx = exp;
377393

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t