Re: [PATCH] x86: Change x86 to use generic find_next_bit

From: Ingo Molnar
Date: Mon Mar 10 2008 - 02:30:12 EST



* Alexander van Heukelum <heukelum@xxxxxxxxxxx> wrote:

> > ok, that's rather convincing.
> >
> > the generic version in lib/find_next_bit.c is open-coded C which gcc
> > can optimize pretty nicely.
> >
> > the hand-coded assembly versions in arch/x86/lib/bitops_32.c mostly
> > use the special x86 'bit search forward' (BSF) instruction - which i
> > know from the days when the scheduler relied on it has some
> > non-trivial setup costs. So especially when there's _small_ bitmasks
> > involved, it's more expensive.
>
> Hi,
>
> BSF is fine, it doesn't need any special setup. [...]

under "setup costs" i mean cycles spent by the CPU itself - the
instruction itself is simple (of course) and needs no setup. If you look
at BSF performance you'll see that it has nontrivial overhead.

Ingo
--
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/