Re: [PATCH 2/2] hrtimer: create for_each_active_base() to iterate over active clock-bases

From: Peter Zijlstra
Date: Thu Apr 02 2015 - 09:45:34 EST


On Thu, Apr 02, 2015 at 04:21:22PM +0530, Viresh Kumar wrote:
> +#define for_each_active_base(_index, _base, _cpu_base, _active_bases) \
> + for ((_active_bases) = (_cpu_base)->active_bases; \
> + (_index) = ffs(_active_bases), \
> + (_base) = (_cpu_base)->clock_base + (_index) - 1, (_index); \
> + (_active_bases) &= ~(1 << ((_index) - 1)))

Can't use ffs here, some people end up using asm-generic/bitops/ffs.h
and that sucks.

Esp for small vectors like here, the unconditional iteration is faster.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/