Hmm, even still I agree with Auke, you probably use it too much.
Actually due to the performance penalty on some systems I think you
only want to use it if the chance of succeeding is 99% or better, as
the benefit if predicted is a cycle or two and the harm if
mispredicted can be more than 50 cycles, depending on the CPU. You
should also remember than in filesystems many "failures" are
triggered by things like the ld.so library searches, where it
literally calls access() 20 different times on various possible paths
for library files, failing the first 19. It does this once for each
necessary library.
Typically you only want to add unlikely() or likely() for about 2
reasons:
(A) It's a hot path and the unlikely case is just going to burn a
bunch of CPU anyways
(B) It really is extremely unlikely that it fails (Think physical
hardware failure)
Anything else is just bogus.
Cheers,
Kyle Moffett
-