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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Sunday, March 9, 2008 - 1:10 pm

* Alexander van Heukelum <heukelum@mailshack.com> 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.


i'm not surprised that the hand-coded assembly versions had a bug ...

[ this means we have to test it quite carefully though, as lots of code 
  only ever gets tested on x86 so code could have built dependency on 
  the buggy behavior. ]


i'd not worry about that too much. Have you tried to build with:

  CONFIG_CC_OPTIMIZE_FOR_SIZE=y
  CONFIG_OPTIMIZE_INLINING=y

(the latter only available in x86.git)


i've picked it up into x86.git, lets see how it goes in practice.

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] x86: Change x86 to use generic find_next_bit, Alexander van Heukelum, (Sun Mar 9, 1:01 pm)
Re: [PATCH] x86: Change x86 to use generic find_next_bit, Ingo Molnar, (Sun Mar 9, 1:10 pm)
Re: [PATCH] x86: Change x86 to use generic find_next_bit, Alexander van Heukelum, (Sun Mar 9, 1:31 pm)
Re: [PATCH] x86: Change x86 to use generic find_next_bit, Alexander van Heukelum, (Sun Mar 9, 2:13 pm)
[RFC/PATCH] x86: Optimize find_next_(zero_)bit for small c ..., Alexander van Heukelum, (Mon Mar 10, 4:17 pm)
[PATCH] x86: Optimize find_next_(zero_)bit for small const ..., Alexander van Heukelum, (Tue Mar 11, 8:17 am)
[RFC] non-x86: Optimize find_next_(zero_)bit for small con ..., Alexander van Heukelum, (Tue Mar 11, 8:22 am)
Re: [PATCH] x86: Change x86 to use generic find_next_bit, Aneesh Kumar K.V, (Thu Mar 13, 5:44 am)
Re: [PATCH] x86: Change x86 to use generic find_next_bit, Alexander van Heukelum, (Thu Mar 13, 7:27 am)