Re: [PATCH 2/5] mm: remove unlikly NULL from kfree

Steven Rostedt
2009-03-25T21:24:23Z

On Wed, 25 Mar 2009, Matt Mackall wrote:
>
> The cost is an unconditional branch; the ret already exists. There's a
> slightly larger cache footprint for the small branch and a slightly
> smaller footprint for the large branch. If p is close to .5 and
> calls/sec is high, the cache footprint is the sum of the footprint of
> both branches. But if calls/sec is close to low, cache footprint is also
> low.
>
> So, yeah, I think this is a good additional argument to err on the side
> of not adding these things at all. And I certainly wasn't intending to
> defend the ones in kfree.
>
> But I'm also skeptical of whether it's worth spending much time actively
> routing out the moderately incorrect instances. It's going to be nearly
> immune to performance benchmarking. We should instead just actively
> discourage using unlikely in new code.
>

Sure. OK, actually I'd say they are valid for 100% hits. These are for
error conditions and trace point like data. Where, we want the least
amount of overhead when the condition is false.

But I can see, we've been brought up (well some of us) that branches are
horrible for pipelines, and any help in deciding the choice is always
tempting.

-- Steve