[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240628041826.68587-1-takakura@valinux.co.jp>
Date: Fri, 28 Jun 2024 13:18:26 +0900
From: takakura@...inux.co.jp
To: paulmck@...nel.org,
frederic@...nel.org,
neeraj.upadhyay@...nel.org,
joel@...lfernandes.org,
josh@...htriplett.org,
boqun.feng@...il.com,
rostedt@...dmis.org,
mathieu.desnoyers@...icios.com,
jiangshanlai@...il.com,
qiang.zhang1211@...il.com,
mingo@...hat.com,
peterz@...radead.org,
juri.lelli@...hat.com,
vincent.guittot@...aro.org,
dietmar.eggemann@....com,
bsegall@...gle.com,
mgorman@...e.de,
bristot@...hat.com,
vschneid@...hat.com
Cc: rcu@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ryo Takakura <takakura@...inux.co.jp>
Subject: [PATCH] rcu: Let rcu_dump_task() be used without preemption disabled
From: Ryo Takakura <takakura@...inux.co.jp>
The commit 2d7f00b2f0130 ("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 <takakura@...inux.co.jp>
---
kernel/rcu/tree_exp.h | 2 --
kernel/sched/core.c | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index 8a1d9c8bd9f7..80c461b26144 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -617,9 +617,7 @@ static void synchronize_rcu_expedited_wait(void)
mask = leaf_node_cpu_bit(rnp, cpu);
if (!(READ_ONCE(rnp->expmask) & mask))
continue;
- preempt_disable(); // For smp_processor_id() in dump_cpu_task().
dump_cpu_task(cpu);
- preempt_enable();
}
rcu_exp_print_detail_task_stall_rnp(rnp);
}
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index bcf2c4cc0522..38efbdafe3d4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -11485,7 +11485,7 @@ struct cgroup_subsys cpu_cgrp_subsys = {
void dump_cpu_task(int cpu)
{
- if (cpu == smp_processor_id() && in_hardirq()) {
+ if (in_hardirq() && cpu == smp_processor_id()) {
struct pt_regs *regs;
regs = get_irq_regs();
--
2.34.1
Powered by blists - more mailing lists