|
36 | 36 | #include <linux/slab.h>
|
37 | 37 | #include <linux/torture.h>
|
38 | 38 | #include <linux/types.h>
|
| 39 | +#include <linux/sched/clock.h> |
39 | 40 |
|
40 | 41 | #include "rcu.h"
|
41 | 42 |
|
@@ -531,6 +532,39 @@ static const struct ref_scale_ops acqrel_ops = {
|
531 | 532 |
|
532 | 533 | static volatile u64 stopopts;
|
533 | 534 |
|
| 535 | +static void ref_sched_clock_section(const int nloops) |
| 536 | +{ |
| 537 | + u64 x = 0; |
| 538 | + int i; |
| 539 | + |
| 540 | + preempt_disable(); |
| 541 | + for (i = nloops; i >= 0; i--) |
| 542 | + x += sched_clock(); |
| 543 | + preempt_enable(); |
| 544 | + stopopts = x; |
| 545 | +} |
| 546 | + |
| 547 | +static void ref_sched_clock_delay_section(const int nloops, const int udl, const int ndl) |
| 548 | +{ |
| 549 | + u64 x = 0; |
| 550 | + int i; |
| 551 | + |
| 552 | + preempt_disable(); |
| 553 | + for (i = nloops; i >= 0; i--) { |
| 554 | + x += sched_clock(); |
| 555 | + un_delay(udl, ndl); |
| 556 | + } |
| 557 | + preempt_enable(); |
| 558 | + stopopts = x; |
| 559 | +} |
| 560 | + |
| 561 | +static const struct ref_scale_ops sched_clock_ops = { |
| 562 | + .readsection = ref_sched_clock_section, |
| 563 | + .delaysection = ref_sched_clock_delay_section, |
| 564 | + .name = "sched-clock" |
| 565 | +}; |
| 566 | + |
| 567 | + |
534 | 568 | static void ref_clock_section(const int nloops)
|
535 | 569 | {
|
536 | 570 | u64 x = 0;
|
@@ -1130,9 +1164,9 @@ ref_scale_init(void)
|
1130 | 1164 | int firsterr = 0;
|
1131 | 1165 | static const struct ref_scale_ops *scale_ops[] = {
|
1132 | 1166 | &rcu_ops, &srcu_ops, &srcu_lite_ops, RCU_TRACE_OPS RCU_TASKS_OPS
|
1133 |
| - &refcnt_ops, &rwlock_ops, &rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops, |
1134 |
| - &clock_ops, &jiffies_ops, &typesafe_ref_ops, &typesafe_lock_ops, |
1135 |
| - &typesafe_seqlock_ops, |
| 1167 | + &refcnt_ops, &rwlock_ops, &rwsem_ops, &lock_ops, &lock_irq_ops, |
| 1168 | + &acqrel_ops, &sched_clock_ops, &clock_ops, &jiffies_ops, |
| 1169 | + &typesafe_ref_ops, &typesafe_lock_ops, &typesafe_seqlock_ops, |
1136 | 1170 | };
|
1137 | 1171 |
|
1138 | 1172 | if (!torture_init_begin(scale_type, verbose))
|
|
0 commit comments