Re: help : likely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 30, 2005 at 04:34:04PM +0530, raja wrote:
>    In kernel code the macros likely() and unlikely() are frequently 
> used.Would you please tell me wht those macros will actually perform?.
> thanking you,

See http://lxr.linux.no/source/include/linux/compiler.h#L60 for the
definition.

As you can see, it uses __builtin_expect(). If you look that up in the
GCC manual (installed on your pc, but also available online at 
http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/Other-Builtins.html ) you
will find that it is used to provide the compiler with branch
prediction information.

If you have no idea what branch prediction is, then don't use likely()
and unlikely() and let the compiler figure out what's best.


Erik

-- 
Erik Mouw
J.A.K.Mouw@xxxxxxxxxxxxxx  mouw@xxxxxxxxxxxx

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux