On Wed, Jul 18, 2018 at 02:03:18PM +0200, Peter Zijlstra wrote:
> On Thu, Jul 12, 2018 at 01:29:40PM -0400, Johannes Weiner wrote:
> > +   for (to = 0; (bo = ffs(set)); to += bo, set >>= bo)
> > +           tasks[to + (bo - 1)]++;
> 
> You want to benchmark this, but since it's only 3 consecutive bits, it
> might actually be faster to not use ffs() and simply test all 3 bits:
> 
>       for (to = set, bo = 0; to; to &= ~(1 << bo), bo++)

                if (to & (1 << bo))

>               tasks[bo]++;


Reply via email to