lkml.org 
[lkml]   [2014]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm: percpu: micro-optimize round-to-even
On Thu, Jun 19, 2014 at 09:25:36AM -0400, Tejun Heo wrote:
> On Thu, Jun 19, 2014 at 12:02:29PM +0200, Rasmus Villemoes wrote:
> > This change shaves a few bytes off the generated code.
> >
> > Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> > ---
> > mm/percpu.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/mm/percpu.c b/mm/percpu.c
> > index 2ddf9a9..978097f 100644
> > --- a/mm/percpu.c
> > +++ b/mm/percpu.c
> > @@ -720,8 +720,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
> > if (unlikely(align < 2))
> > align = 2;
> >
> > - if (unlikely(size & 1))
> > - size++;
> > + size += size & 1;
>
> I'm not gonna apply this. This isn't that hot a path. It's not
> worthwhile to micro optimize code like this.

Another thing is that it isn't even clear whether the micro
optimization is even actually better given that predicted branches are
extremely cheap and this one is extremely predictable. So, again,
let's please leave it to the compiler.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2014-06-19 17:21    [W:0.065 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site