Skip to content

Commit 51b7399

Browse files
ryotakakura98Neeraj Upadhyay
authored andcommitted
rcu: Let dump_cpu_task() be used without preemption disabled
The commit 2d7f00b ("rcu: Suppress smp_processor_id() complaint in synchronize_rcu_expedited_wait()") disabled preemption around dump_cpu_task() to suppress warning on its usage within preemtible context. Calling dump_cpu_task() doesn't required to be in non-preemptible context except for suppressing the smp_processor_id() warning. As the smp_processor_id() is evaluated along with in_hardirq() to check if it's in interrupt context, this patch removes the need for its preemtion disablement by reordering the condition so that smp_processor_id() only gets evaluated when it's in interrupt context. Signed-off-by: Ryo Takakura <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Neeraj Upadhyay <[email protected]>
1 parent 7c72ded commit 51b7399

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

kernel/rcu/tree_exp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,7 @@ static void synchronize_rcu_expedited_stall(unsigned long jiffies_start, unsigne
597597
mask = leaf_node_cpu_bit(rnp, cpu);
598598
if (!(READ_ONCE(rnp->expmask) & mask))
599599
continue;
600-
preempt_disable(); // For smp_processor_id() in dump_cpu_task().
601600
dump_cpu_task(cpu);
602-
preempt_enable();
603601
}
604602
rcu_exp_print_detail_task_stall_rnp(rnp);
605603
}

kernel/sched/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9726,7 +9726,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
97269726

97279727
void dump_cpu_task(int cpu)
97289728
{
9729-
if (cpu == smp_processor_id() && in_hardirq()) {
9729+
if (in_hardirq() && cpu == smp_processor_id()) {
97309730
struct pt_regs *regs;
97319731

97329732
regs = get_irq_regs();

0 commit comments

Comments
 (0)