likely() and unlikely()

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

 



Hi All,

What do likely() and unlikely()  mean ?


I see that it says :

linux-2.6.30.2\linux-2.6.30.2\include\linux\compiler.h"

/*
 * Using __builtin_constant_p(x) to ignore cases where the return
 * value is always the same.  This idea is taken from a similar patch
 * written by Daniel Walker.
 */
# ifndef likely
#  define likely(x)    (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
# endif
# ifndef unlikely
#  define unlikely(x)    (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
# endif

but can't easliy recognize what is actually intended when likely() and unlikely() is used ??

for instance :
here
if (likely((atomic_read(&files->count) == 1)))


Regards,
Leena //

[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