RCU Archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Alan Huang <mmpgouride@gmail.com>,
	paulmck@kernel.org, frederic@kernel.org,
	neeraj.upadhyay@kernel.org, joel@joelfernandes.org,
	josh@joshtriplett.org, boqun.feng@gmail.com, rostedt@goodmis.org,
	jiangshanlai@gmail.com, qiang.zhang1211@gmail.com
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rcu: Remove unreachable logic
Date: Mon, 29 Apr 2024 13:43:10 -0400	[thread overview]
Message-ID: <bb48fdad-7a00-45da-b545-60517267a2c8@efficios.com> (raw)
In-Reply-To: <20240429173439.1685274-1-mmpgouride@gmail.com>

On 2024-04-29 13:34, Alan Huang wrote:
> 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.

Nack.

call_rcu_core() receives a @flags parameter which are the _saved_ flags
as they were prior to local_irq_save().

This patch highlights a misunderstanding of what the code is actually
doing.

Thanks,

Mathieu

> 
> 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);
>   }
>   

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


      reply	other threads:[~2024-04-29 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 17:34 [PATCH] rcu: Remove unreachable logic Alan Huang
2024-04-29 17:43 ` Mathieu Desnoyers [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=bb48fdad-7a00-45da-b545-60517267a2c8@efficios.com \
    --to=mathieu.desnoyers@efficios.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=mmpgouride@gmail.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).