From: Alan Huang <mmpgouride@gmail.com>
To: paulmck@kernel.org, frederic@kernel.org,
neeraj.upadhyay@kernel.org, joel@joelfernandes.org,
josh@joshtriplett.org, boqun.feng@gmail.com, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
qiang.zhang1211@gmail.com
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
Alan Huang <mmpgouride@gmail.com>
Subject: [PATCH] rcu: Remove unreachable logic
Date: Tue, 30 Apr 2024 01:34:39 +0800 [thread overview]
Message-ID: <20240429173439.1685274-1-mmpgouride@gmail.com> (raw)
call_rcu_core is only called from __call_rcu_common with interrupt
disabled. This patch thus removes the unreachable logic and the would-be
unused 'flags' parameter.
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
kernel/rcu/tree.c | 35 ++---------------------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index d5507ac1bbf1..b0ea2ebd7769 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2983,7 +2983,7 @@ static void rcutree_enqueue(struct rcu_data *rdp, struct rcu_head *head, rcu_cal
* Handle any core-RCU processing required by a call_rcu() invocation.
*/
static void call_rcu_core(struct rcu_data *rdp, struct rcu_head *head,
- rcu_callback_t func, unsigned long flags)
+ rcu_callback_t func)
{
rcutree_enqueue(rdp, head, func);
/*
@@ -2992,37 +2992,6 @@ static void call_rcu_core(struct rcu_data *rdp, struct rcu_head *head,
*/
if (!rcu_is_watching())
invoke_rcu_core();
-
- /* If interrupts were disabled or CPU offline, don't invoke RCU core. */
- if (irqs_disabled_flags(flags) || cpu_is_offline(smp_processor_id()))
- return;
-
- /*
- * Force the grace period if too many callbacks or too long waiting.
- * Enforce hysteresis, and don't invoke rcu_force_quiescent_state()
- * if some other CPU has recently done so. Also, don't bother
- * invoking rcu_force_quiescent_state() if the newly enqueued callback
- * is the only one waiting for a grace period to complete.
- */
- if (unlikely(rcu_segcblist_n_cbs(&rdp->cblist) >
- rdp->qlen_last_fqs_check + qhimark)) {
-
- /* Are we ignoring a completed grace period? */
- note_gp_changes(rdp);
-
- /* Start a new grace period if one not already started. */
- if (!rcu_gp_in_progress()) {
- rcu_accelerate_cbs_unlocked(rdp->mynode, rdp);
- } else {
- /* Give the grace period a kick. */
- rdp->blimit = DEFAULT_MAX_RCU_BLIMIT;
- if (READ_ONCE(rcu_state.n_force_qs) == rdp->n_force_qs_snap &&
- rcu_segcblist_first_pend_cb(&rdp->cblist) != head)
- rcu_force_quiescent_state();
- rdp->n_force_qs_snap = READ_ONCE(rcu_state.n_force_qs);
- rdp->qlen_last_fqs_check = rcu_segcblist_n_cbs(&rdp->cblist);
- }
- }
}
/*
@@ -3121,7 +3090,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
if (unlikely(rcu_rdp_is_offloaded(rdp)))
call_rcu_nocb(rdp, head, func, flags, lazy);
else
- call_rcu_core(rdp, head, func, flags);
+ call_rcu_core(rdp, head, func);
local_irq_restore(flags);
}
--
2.44.0
next reply other threads:[~2024-04-29 17:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-29 17:34 Alan Huang [this message]
2024-04-29 17:43 ` [PATCH] rcu: Remove unreachable logic Mathieu Desnoyers
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=20240429173439.1685274-1-mmpgouride@gmail.com \
--to=mmpgouride@gmail.com \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).