From: Zqiang <qiang.zhang@linux.dev>
To: paulmck@kernel.org, frederic@kernel.org,
neeraj.upadhyay@kernel.org, joelagnelf@nvidia.com,
boqun.feng@gmail.com, urezki@gmail.com
Cc: qiang.zhang@linux.dev, rcu@vger.kernel.org
Subject: [PATCH v2] rcu: Remove local_irq_save/restore() in rcu_preempt_deferred_qs_handler()
Date: Wed, 13 Aug 2025 21:30:02 +0800 [thread overview]
Message-ID: <20250813133002.331879-1-qiang.zhang@linux.dev> (raw)
Currently, the per-cpu rcu_data structure's->defer_qs_iw is initialized by
IRQ_WORK_INIT_HARD(), this means the rcu_preempt_deferred_qs_handler()
always be executed in the hardirq context of irq-disabled.
This commit therefore remove local_irq_save/restore() operations in
rcu_preempt_deferred_qs_handler() and add lockdep_assert_irqs_disabled()
check, if someone mistakenly invokes this function in hardirq enabled
context will splat.
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
kernel/rcu/tree_plugin.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index fc14adf15cbb..57e2ae51c0b2 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -626,11 +626,10 @@ notrace void rcu_preempt_deferred_qs(struct task_struct *t)
*/
static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp)
{
- unsigned long flags;
struct rcu_data *rdp;
+ lockdep_assert_irqs_disabled();
rdp = container_of(iwp, struct rcu_data, defer_qs_iw);
- local_irq_save(flags);
/*
* If the IRQ work handler happens to run in the middle of RCU read-side
@@ -647,8 +646,6 @@ static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp)
*/
if (rcu_preempt_depth() > 0)
WRITE_ONCE(rdp->defer_qs_iw_pending, DEFER_QS_IDLE);
-
- local_irq_restore(flags);
}
/*
--
2.48.1
next reply other threads:[~2025-08-13 13:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 13:30 Zqiang [this message]
2025-08-13 21:13 ` [PATCH v2] rcu: Remove local_irq_save/restore() in rcu_preempt_deferred_qs_handler() Paul E. McKenney
2025-08-14 13:11 ` Zqiang
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=20250813133002.331879-1-qiang.zhang@linux.dev \
--to=qiang.zhang@linux.dev \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=joelagnelf@nvidia.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).