lkml.org 
[lkml]   [2009]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH] flex_array: conditionally optimize out divides
From
Date
On Tue, 2009-08-18 at 11:02 -0700, Dan Williams wrote:
> > + return flex_array_get_precalc(fa, part_nr, index_inside);
> > +}
> > +
> > +static inline int flex_array_put_es(struct flex_array *fa, int element_nr,
> > + int element_size, void *src, gfp_t flags)
> > +{
> > + int part_nr = __fa_element_to_part_nr(element_size, element_nr);
> > + int index_inside = __fa_index_inside_part(element_size, element_nr);
> > +
> > + if (element_nr >= fa->total_nr_elements)
> > + return -ENOSPC;
>
> ...and this one look like good candidates for unlikely() as these
> additional branches may be a concern for the fast path.

Personally, I think those macros are grossly overused. I'm loathe to
use them unless there's actual profiling data showing that they make an
appreciable performance improvement or that the generated code is
unquestionably better.

-- Dave



\
 
 \ /
  Last update: 2009-08-18 23:33    [W:0.052 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site