All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
	dvhltc@us.ibm.com, niv@us.ibm.com, tglx@linutronix.de,
	peterz@infradead.org, rostedt@goodmis.org,
	Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
	eric.dumazet@gmail.com
Subject: Re: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
Date: Fri, 16 Apr 2010 21:53:27 -0700	[thread overview]
Message-ID: <20100417045326.GA11604@feather> (raw)
In-Reply-To: <20100416222927.GP2615@linux.vnet.ibm.com>

On Fri, Apr 16, 2010 at 03:29:27PM -0700, Paul E. McKenney wrote:
> On Fri, Apr 16, 2010 at 02:16:10PM -0700, Josh Triplett wrote:
> > On Fri, Apr 16, 2010 at 07:23:48AM -0700, Paul E. McKenney wrote:
> > > On Thu, Apr 15, 2010 at 04:52:52PM -0700, Josh Triplett wrote:
> > > > On Thu, Apr 15, 2010 at 11:13:25AM -0700, Paul E. McKenney wrote:
> > > > > From: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > 
> > > > > cleanup: make dead code really dead
> > > > > 
> > > > > Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> > > > > Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > > > ---
> > > > >  kernel/rcutree.c |    4 ++--
> > > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > > > > index e54c123..6042fb8 100644
> > > > > --- a/kernel/rcutree.c
> > > > > +++ b/kernel/rcutree.c
> > > > > @@ -1236,11 +1236,11 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
> > > > >  		break; /* grace period idle or initializing, ignore. */
> > > > >  
> > > > >  	case RCU_SAVE_DYNTICK:
> > > > > -
> > > > > -		raw_spin_unlock(&rnp->lock);  /* irqs remain disabled */
> > > > >  		if (RCU_SIGNAL_INIT != RCU_SAVE_DYNTICK)
> > > > >  			break; /* So gcc recognizes the dead code. */
> > > > 
> > > > GCC's new __builtin_unreachable would help here, though obviously we
> > > > can't count on 4.5 or newer quite yet.  A wrapper in compiler.h would
> > > > let us use it when available though.
> > > 
> > > So at some time when we can count on gcc 4.5 or newer, the code
> > > would look something like the following?
> > > 
> > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > 		this_is_unreachable();
> > 
> > Yes, exactly.
> > 
> > > I suppose that in the meantime one could supply the code to use
> > > in the unreachable case:
> > > 
> > > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK)
> > > 		this_is_unreachable(break);
> > > 
> > > But this is beginning to seem a bit strained to me.  ;-)
> > 
> > I'd suggest spelling that this way:
> > 
> > 	if (RCU_SIGNAL_INIT == RCU_SAVE_DYNTICK) {
> > 		unreachable();
> > 		break;
> > 	}
> > 
> > But in any case, all of these do seem excessive just to avoid the need
> > for an ifdef. :)
> 
> Actually, the "if" condition is a comparison of numerical constants,
> so no #ifdef is required.

I just meant that those constants get #defined based on CONFIG_NO_HZ, so
an #ifdef on that would remove the need for the special handling of dead
code.

- Josh Triplett

  reply	other threads:[~2010-04-17  5:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 18:12 [PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35 Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_resched for sending resched IPIs Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead Paul E. McKenney
2010-04-15 23:52   ` Josh Triplett
2010-04-16 14:23     ` Paul E. McKenney
2010-04-16 21:16       ` Josh Triplett
2010-04-16 22:29         ` Paul E. McKenney
2010-04-17  4:53           ` Josh Triplett [this message]
2010-04-18  1:12             ` Paul E. McKenney
2010-04-18  3:53               ` Josh Triplett
2010-04-18 13:42                 ` Paul E. McKenney
2010-04-18 21:12                   ` Josh Triplett
2010-04-18 21:54                     ` Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 03/16] rcu: move some code from macro to function Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 04/16] rcu: ignore offline CPUs in last non-dyntick-idle CPU check Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 05/16] rcu: Fix bogus CONFIG_PROVE_LOCKING in comments to reflect reality Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 06/16] rcu: fix now-bogus rcu_scheduler_active comments Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 08/16] rcu: rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 09/16] rcu: refactor RCU's context-switch handling Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 11/16] rcu: enable CPU_STALL_VERBOSE by default Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 12/16] rcu: disable CPU stall warnings upon panic Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 13/16] rcu: print boot-time console messages if RCU configs out of ordinary Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 14/16] rcu: improve RCU CPU stall-warning messages Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 15/16] rcu: permit discontiguous cpu_possible_mask CPU numbering Paul E. McKenney
2010-04-15 18:13 ` [PATCH RFC tip/core/rcu 16/16] rcu: v2: reduce the number of spurious RCU_SOFTIRQ invocations Paul E. McKenney
2010-04-20 10:11 ` [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by making synchronize_rcu_bh() be inline David Howells
2010-04-20 15:05   ` Paul E. McKenney
2010-04-20 10:15 ` [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by removing rcu_scheduler_active and friends David Howells
2010-04-20 19:18   ` Paul E. McKenney

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=20100417045326.GA11604@feather \
    --to=josh@joshtriplett.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=dvhltc@us.ibm.com \
    --cc=eric.dumazet@gmail.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=niv@us.ibm.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.