History

refscale: Add measurement of clock readout

This commit adds a "clock" type to refscale, which checks the performance of ktime_get_real_fast_ns(). Use the "clocksource=" kernel boot parameter to select the underlying clock source. [ paulmck: Work around compiler false positive per kernel test robot. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

Paul E. McKenney committed 5 years ago

Commit 25f6fa51 parent 2734d6c1 file · +35 −1Browse files

Unified · Split

kernel/rcu/refscale.c+35−1
@@ -467,6 +467,40 @@ static struct ref_scale_ops acqrel_ops = { · 466 unmodified lines
467 .name = "acqrel"467 .name = "acqrel"
468};468};
469 469
470static volatile u64 stopopts;
471
472static void ref_clock_section(const int nloops)
473{
474 u64 x = 0;
475 int i;
476
477 preempt_disable();
478 for (i = nloops; i >= 0; i--)
479 x += ktime_get_real_fast_ns();
480 preempt_enable();
481 stopopts = x;
482}
483
484static void ref_clock_delay_section(const int nloops, const int udl, const int ndl)
485{
486 u64 x = 0;
487 int i;
488
489 preempt_disable();
490 for (i = nloops; i >= 0; i--) {
491 x += ktime_get_real_fast_ns();
492 un_delay(udl, ndl);
493 }
494 preempt_enable();
495 stopopts = x;
496}
497
498static struct ref_scale_ops clock_ops = {
499 .readsection = ref_clock_section,
500 .delaysection = ref_clock_delay_section,
501 .name = "clock"
502};
503
470static void rcu_scale_one_reader(void)504static void rcu_scale_one_reader(void)
471{505{
472 if (readdelay <= 0)506 if (readdelay <= 0)
@@ -759,7 +793,7 @@ ref_scale_init(void) · 286 unmodified lines
759 int firsterr = 0;793 int firsterr = 0;
760 static struct ref_scale_ops *scale_ops[] = {794 static struct ref_scale_ops *scale_ops[] = {
761 &rcu_ops, &srcu_ops, &rcu_trace_ops, &rcu_tasks_ops, &refcnt_ops, &rwlock_ops,795 &rcu_ops, &srcu_ops, &rcu_trace_ops, &rcu_tasks_ops, &refcnt_ops, &rwlock_ops,
762 &rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops,796 &rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops, &clock_ops,
763 };797 };
764 798
765 if (!torture_init_begin(scale_type, verbose))799 if (!torture_init_begin(scale_type, verbose))

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