Skip to content

Commit e6a43ae

Browse files
Zqiangpaulmckrcu
authored andcommitted
srcu/tiny: Remove preempt_disable/enable() in srcu_gp_start_if_needed()
Currently, the srcu_gp_start_if_needed() is always be invoked in preempt disable's critical section, this commit therefore remove redundant preempt_disable/enable() in srcu_gp_start_if_needed() and adds a call to lockdep_assert_preemption_disabled() in order to enable lockdep to diagnose mistaken invocations of this function from preempts-enabled code. Fixes: 65b4a59 ("srcu: Make Tiny SRCU explicitly disable preemption") Signed-off-by: Zqiang <qiang.zhang@linux.dev> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 1c77e86 commit e6a43ae

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

kernel/rcu/srcutiny.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,9 @@ static void srcu_gp_start_if_needed(struct srcu_struct *ssp)
176176
{
177177
unsigned long cookie;
178178

179-
preempt_disable(); // Needed for PREEMPT_LAZY
179+
lockdep_assert_preemption_disabled(); // Needed for PREEMPT_LAZY
180180
cookie = get_state_synchronize_srcu(ssp);
181181
if (ULONG_CMP_GE(READ_ONCE(ssp->srcu_idx_max), cookie)) {
182-
preempt_enable();
183182
return;
184183
}
185184
WRITE_ONCE(ssp->srcu_idx_max, cookie);
@@ -189,7 +188,6 @@ static void srcu_gp_start_if_needed(struct srcu_struct *ssp)
189188
else if (list_empty(&ssp->srcu_work.entry))
190189
list_add(&ssp->srcu_work.entry, &srcu_boot_list);
191190
}
192-
preempt_enable();
193191
}
194192

195193
/*

0 commit comments

Comments
 (0)