From: neeraj.upadhyay@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
rostedt@goodmis.org, paulmck@kernel.org,
neeraj.upadhyay@kernel.org, neeraj.upadhyay@amd.com,
boqun.feng@gmail.com, joel@joelfernandes.org, urezki@gmail.com,
frederic@kernel.org, Ryo Takakura <takakura@valinux.co.jp>
Subject: [PATCH rcu 4/4] rcu: Let dump_cpu_task() be used without preemption disabled
Date: Fri, 16 Aug 2024 11:43:04 +0530 [thread overview]
Message-ID: <20240816061304.48843-4-neeraj.upadhyay@kernel.org> (raw)
In-Reply-To: <20240816061050.GA46994@neeraj.linux>
From: Ryo Takakura <takakura@valinux.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@valinux.co.jp>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
---
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 d4be644afb50..c5d9a7eb0803 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -597,9 +597,7 @@ static void synchronize_rcu_expedited_stall(unsigned long jiffies_start, unsigne
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 a9f655025607..78ae888a1fa2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -9726,7 +9726,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.40.1
prev parent reply other threads:[~2024-08-16 6:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 6:10 [PATCH rcu 0/4] RCU stall updates for v6.12 Neeraj Upadhyay
2024-08-16 6:13 ` [PATCH rcu 1/4] rcu: Summarize RCU CPU stall warnings during CSD-lock stalls neeraj.upadhyay
2024-08-16 6:13 ` [PATCH rcu 2/4] rcu: Extract synchronize_rcu_expedited_stall() from synchronize_rcu_expedited_wait() neeraj.upadhyay
2024-08-16 6:13 ` [PATCH rcu 3/4] rcu: Summarize expedited RCU CPU stall warnings during CSD-lock stalls neeraj.upadhyay
2024-08-16 6:13 ` neeraj.upadhyay [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816061304.48843-4-neeraj.upadhyay@kernel.org \
--to=neeraj.upadhyay@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.upadhyay@amd.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=takakura@valinux.co.jp \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®