mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@osdl.org>, Jeff Garzik <jeff@garzik.org>,
	linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [PATCH] ext3_clear_inode(): avoid kfree(NULL)
Date: Sat, 24 Jun 2006 14:53:55 +0200	[thread overview]
Message-ID: <1151153635.3181.41.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1151153177.3181.39.camel@laptopd505.fenrus.org>

On Sat, 2006-06-24 at 14:46 +0200, Arjan van de Ven wrote:
> On Sat, 2006-06-24 at 08:33 -0400, Steven Rostedt wrote:
> > On Sat, 24 Jun 2006, Arjan van de Ven wrote:
> > 
> > > On Sat, 2006-06-24 at 08:20 -0400, Steven Rostedt wrote:
> > > > On Sat, 24 Jun 2006, Arjan van de Ven wrote:
> > > >
> > > > >
> > > > > >
> > > > > > Because at that callsite, NULL is the common case.  We avoid a do-nothing
> > > > > > function call most of the time.  It's a nano-optimisation.
> > > > >
> > > > > but a function call is basically free, while an if () is not... even
> > > > > with unlikely()...
> > > > >
> > > > > sounds like a misoptimization to me.
> > > > >
> > > >
> > > > How is a function call free when an if is not?
> > >
> > > in general, a function call is 100% predictable without any real control
> > > flow dependencies for the processor, and thus there is no real issue in
> > > the execution pipeline. An if is a conditional branch, which breaks up
> > > the execution pipeline if mispredicted...
> > 
> > But doesn't the unlikely help the prediction? 
> 
> nope none at all, at least not on x86/x86-64.
> (in fact there is no way to help the prediction on those architectures
> that actually works)

ok that's not entirely accurate, there's some basic heuristics you can
tweak to; eg often the assumption is "if you jump backwards the branch
is taken" and stuff like that, but that's generally useful in loops, not
so much in if () statements.... since for if () both your branches are
forward.


  parent reply	other threads:[~2006-06-24 12:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200606231502.k5NF2jfO007109@hera.kernel.org>
2006-06-23 18:51 ` Jeff Garzik
2006-06-23 21:24   ` Andrew Morton
2006-06-24 12:11     ` Arjan van de Ven
2006-06-24 12:20       ` Steven Rostedt
2006-06-24 12:27         ` Arjan van de Ven
2006-06-24 12:33           ` Steven Rostedt
2006-06-24 12:46             ` Arjan van de Ven
2006-06-24 12:51               ` Steven Rostedt
2006-06-24 12:53               ` Arjan van de Ven [this message]
2006-06-24 13:07                 ` Steven Rostedt
2006-06-24 14:11                   ` Arjan van de Ven
2006-06-24 16:06                     ` Nick Piggin
2006-06-24 16:49               ` Jeremy Fitzhardinge
2006-06-24 16:55                 ` Arjan van de Ven
2006-06-24 16:19       ` Pekka Enberg

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=1151153635.3181.41.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=akpm@osdl.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®