lkml.org 
[lkml]   [2010]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead
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();

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

Thanx, Paul


\
 
 \ /
  Last update: 2010-04-16 16:27    [W:0.097 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site