On Wed, Jul 09, 2014 at 11:31:45PM +0200, Thomas Hellström wrote:
Speaking of verbose, all the likely/unlikely annotations should be removed.
Is this your personal opinion or has there been some kind of kernel developer agreement not to add this annotation and remove it from the kernel tree? If not, I prefer to keep it.
It obviously makes the code less readable. It makes a small speedup if the code is called 10000 times with the and the expected value is true every time. If more than 1 out of 10000 values is unexpected then it is a slow down.
There are two rules of thumb for likely/unlikely:
1) Don't use it in the drivers/ directory. 2) Or don't use it without benchmarking it.
These are general rules, not mine.
In the olden days we used to use it more often but then people did benchmarking and likely/unlikely annotations didn't make a single measurable difference on normal benchmarks at all. Maybe on a micro benchmark. Also perhaps in those days people hadn't done branch profiling so we were getting a lot of unexpected conditions and the slow downs were canceling the speed ups.
regards, dan carpenter