Skip to content

Commit 78a731c

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
refscale: Add local_bh_disable() readers
This commit adds refscale readers based on local_bh_disable() and local_bh_enable() ("refscale.scale_type=bh"). On my x86 laptop, these are about 4.9ns. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent edd6f78 commit 78a731c

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

kernel/rcu/refscale.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,37 @@ static const struct ref_scale_ops jiffies_ops = {
629629
.name = "jiffies"
630630
};
631631

632+
static void ref_bh_section(const int nloops)
633+
{
634+
int i;
635+
636+
preempt_disable();
637+
for (i = nloops; i >= 0; i--) {
638+
local_bh_disable();
639+
local_bh_enable();
640+
}
641+
preempt_enable();
642+
}
643+
644+
static void ref_bh_delay_section(const int nloops, const int udl, const int ndl)
645+
{
646+
int i;
647+
648+
preempt_disable();
649+
for (i = nloops; i >= 0; i--) {
650+
local_bh_disable();
651+
un_delay(udl, ndl);
652+
local_bh_enable();
653+
}
654+
preempt_enable();
655+
}
656+
657+
static const struct ref_scale_ops bh_ops = {
658+
.readsection = ref_bh_section,
659+
.delaysection = ref_bh_delay_section,
660+
.name = "bh"
661+
};
662+
632663
static void ref_irq_section(const int nloops)
633664
{
634665
int i;
@@ -1229,7 +1260,8 @@ ref_scale_init(void)
12291260
static const struct ref_scale_ops *scale_ops[] = {
12301261
&rcu_ops, &srcu_ops, &srcu_fast_ops, RCU_TRACE_OPS RCU_TASKS_OPS
12311262
&refcnt_ops, &rwlock_ops, &rwsem_ops, &lock_ops, &lock_irq_ops,
1232-
&acqrel_ops, &sched_clock_ops, &clock_ops, &jiffies_ops, &irq_ops, &irqsave_ops,
1263+
&acqrel_ops, &sched_clock_ops, &clock_ops, &jiffies_ops,
1264+
&bh_ops, &irq_ops, &irqsave_ops,
12331265
&typesafe_ref_ops, &typesafe_lock_ops, &typesafe_seqlock_ops,
12341266
};
12351267

0 commit comments

Comments
 (0)